-
Notifications
You must be signed in to change notification settings - Fork 10
64 lines (51 loc) · 1.56 KB
/
action-update-lists.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
---
name: 'Update Domain List'
on:
workflow_dispatch:
schedule:
- cron: '0 10 15 * *' # At 10:00 on day-of-month 15
env:
FOLDER: '${{ github.workspace }}/cloudflare/lists'
permissions: read-all
jobs:
auto-update:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
pull-requests: write
steps:
- name: 📂 Checkout Branch
uses: actions/checkout@v3.5.2
#
# Fetch domain list
#
- name: 🔗 Fetch Domain List
working-directory: ${{ env.FOLDER }}
run: |
LIST_URL="https://adaway.org/hosts.txt"
LIST_FNAME="pihole_domain_list.txt"
echo "[*] Fetching list: ${LIST_URL} -> ${LIST_FNAME}"
wget --quiet $LIST_URL -O $LIST_FNAME
echo "[*] Sorting list..."
sort -u -o $LIST_FNAME $LIST_FNAME
echo "[*] Removing comments..."
grep -o '^[^#]*' $LIST_FNAME > temp.txt
mv temp.txt $LIST_FNAME
echo "[*] Extracting domains..."
cat $LIST_FNAME | awk '{ print $2 }' > temp.txt
mv temp.txt $LIST_FNAME
echo "[*] Removing localhost from list..."
sed -i '/localhost/d' $LIST_FNAME
sed -i '/127.0.0.1/d' $LIST_FNAME
#
# Commit file
#
- name: ↗️ Create Pull Request
uses: peter-evans/create-pull-request@v5.0.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: 'Update Domain List'
branch-suffix: timestamp
commit-message: 'Update Domain List'
body: ''