-
Notifications
You must be signed in to change notification settings - Fork 268
42 lines (36 loc) · 1.36 KB
/
auto-generate-pac.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: Auto Generate PAC File
on:
schedule:
- cron: '10 0 * * 4'
push:
paths:
- 'gfw-pac.py'
- 'pac-template'
- 'local-tlds.txt'
- 'direct-domains.txt'
- 'proxy-domains.txt'
- 'cidrs-cn.txt'
workflow_dispatch:
jobs:
update-gfw-pac:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download the latest cn.txt
run: curl -L https://raw.githubusercontent.com/Loyalsoldier/geoip/release/text/cn.txt -o cidrs-cn.txt
- name: Run gfw-pac.py script
run: ./gfw-pac.py -f gfw.pac -p "PROXY 127.0.0.1:3128" --proxy-domains=proxy-domains.txt --direct-domains=direct-domains.txt --localtld-domains=local-tlds.txt --ip-file=cidrs-cn.txt
- name: Commit and push changes
run: |
last_commit_message=$(git log -1 --pretty=%B)
commit_message=$([[ "${{ github.event_name }}" == "schedule" ]] && echo "定期更新数据并生成 gfw.pac" || echo "自动生成 gfw.pac: $last_commit_message")
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add -A
git commit -a -m "${commit_message}"
git push
- name: Trigger Auto-Release
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Auto Generate Release