Update hosts blocklist #1472
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: "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 |