Auto Build PAC #49
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Auto Build PAC | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '51 3 * * *' | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.10" | |
- name: Build | |
run: | | |
curl -o delegated-apnic-latest.txt https://ftp.apnic.net/stats/apnic/delegated-apnic-latest | |
./gfw-pac.py -f gfw.pac \ | |
-p "PROXY 127.0.0.1:6565; DIRECT" \ | |
--user-rule=custom-domains.txt \ | |
--direct-rule=direct-domains.txt \ | |
--localtld-rule=local-tlds.txt \ | |
--ip-file=delegated-apnic-latest.txt | |
git add . | |
- name: Set up SSH keys | |
run: | | |
mkdir ~/.ssh | |
git config --global user.email "[email protected]" | |
git config --global user.name "Dark495Bot" | |
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa | |
chmod 700 ~/.ssh | |
chmod 600 ~/.ssh/id_rsa | |
- name: Pull latest changes from the remote repo | |
run: git pull -f origin $GITHUB_REF | |
- name: Commit and push changes | |
run: | | |
if [[ $(git status -s | wc -l) -gt 0 ]]; then | |
git commit -m "Auto Update at $(date "+%Y-%m-%d %T")"; | |
git push origin HEAD:$GITHUB_REF; | |
fi |