-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (80 loc) · 2.85 KB
/
update.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: Update Filters
on:
workflow_dispatch:
schedule:
- cron: 0 */8 * * *
env:
TZ: Asia/Shanghai
jobs:
Update_Filters:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@main
- name: add Checkout 217heidai/adblockfilters
uses: actions/checkout@v4
with:
repository: 217heidai/adblockfilters
path: community
- name: Setup Python 3.9.x
uses: actions/setup-python@main
with:
python-version: '3.9.x'
- name: Install Dependencies
run: |
sudo timedatectl set-timezone "$TZ"
python -m pip install --upgrade pip
pip install -U tld IPy dnspython httpx loguru
- name: add Modify source file
run: |
rm -rf app* rules* *.*
mv -f community/* ./
rm -rf community*
cp readme/README.md .
sed -i '/Star History/d' readme.py
sed -i 's/217heidai\/adblockfilters\/main/Sereinfy\/Adrules\/main/g' readme.py
sed -i 's/217heidai\/adblockfilters@main/Sereinfy\/Adrules@main/g' readme.py refreshcdn.py
sed -i 's/217heidai\/adblockfilters/Sereinfy\/Adrules/g' app/base.py filter.py
sed -i 's/个人收藏了不少广告过滤规则.*/Forked From [217heidai\/adblockfilters](https:\/\/github.com\/217heidai\/adblockfilters) \\n")/' readme.py
find . -type f -name "*.py" -exec sed -i '/f.write("! Source/d' {} +
find . -type f -name "*.py" -exec sed -i '/f.write("! Description/d' {} +
- name: Update Filters
id: update
run: |
python adblock.py
python readme/clash.py rules/adblockdnslite.txt rules/dnslite_for_clash.yaml
python readme/clash.py rules/adblockdns.txt rules/dns_for_clash.yaml
python readme/line.py
rm -rf __pycache__
rm -rf app/__pycache__
echo "message=$(date)" >> $GITHUB_OUTPUT
- name: Commit Changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: ${{ steps.update.outputs.message }}
Refresh_CDN:
needs: [ Update_Filters ]
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@main
- name: Setup Python 3.9.x
uses: actions/setup-python@main
with:
python-version: '3.9.x'
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -U tld IPy dnspython httpx loguru
- name: Refsh CDN Cache
run: |
python refreshcdn.py
Delete_Workflow_Runs:
needs: [ Refresh_CDN ]
runs-on: ubuntu-latest
steps:
- name: Delete workflow runs
uses: Mattraks/delete-workflow-runs@main
with:
retain_days: 0
keep_minimum_runs: 5