-
Notifications
You must be signed in to change notification settings - Fork 4
39 lines (33 loc) · 1.08 KB
/
update-hosts.yaml
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
name: "Update hosts blocklist"
on:
push:
branches: ["*"]
schedule:
- cron: "0 0 * * *"
jobs:
main:
runs-on: "ubuntu-latest"
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
- name: "Update hosts blocklist"
run: |
echo -e 'Automatic hosts blocklist update\n' >> commit.txt
echo 'Sources:' >> commit.txt
for url in $(curl --silent --show-error 'https://v.firebog.net/hosts/lists.php?type=tick'); do
echo " - '${url}'" >> commit.txt
curl --silent --show-error "${url}" \
| sed 's/#.*//g' \
| sed 's/\s*$//g' \
| sed 's/^.*\s//g' \
| sed 's/[^a-zA-Z0-9.\-]//g' \
| sed '/^\s*$/d' \
| sed '/^localhost$/d' \
>> hosts.tmp
done
sort hosts.tmp | uniq | sed 's/^/0.0.0.0 /g' > hosts
git config user.name github-actions
git config user.email [email protected]
git add hosts
git commit --allow-empty --file commit.txt
git push