Create hosts files for EasyPrivacy filter list #214
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: Create hosts files for EasyPrivacy filter list | |
on: | |
schedule: | |
- cron: '0 0 * * 0' | |
workflow_dispatch: | |
defaults: | |
run: | |
working-directory: ./easyprivacy | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Create dist directory | |
run: | | |
mkdir -p dist | |
- name: Download filter list | |
run: | | |
wget -O easyprivacy.txt https://easylist.to/easylist/easyprivacy.txt | |
- name: Create hosts file | |
run: | | |
cat easyprivacy.txt | \ | |
egrep '! (Version|Title|Last modified|Expires|Homepage|Licence):' | \ | |
sed -e 's/^!/#/' > dist/hosts | |
echo >> dist/hosts | |
- name: Add hostnames | |
run: | | |
cat easyprivacy.txt | grep '^||.*\^$\|^||.*\^\$' | \ | |
grep -v '\*' | cut -d '^' -f 1 | sed -e 's/||//' | \ | |
sort -u >> dist/hosts | |
- name: Create hosts file without IP addresses | |
run: | | |
cat dist/hosts | egrep -v '^([0-9]{1,3}\.){3}[0-9]{1,3}$' > dist/hosts-noip | |
- name: Create IPv4 hosts file | |
run: | | |
sed -e 's/^\([^#]\)/0.0.0.0 \1/' dist/hosts > dist/hosts-ipv4 | |
- name: Commit changes | |
uses: EndBug/add-and-commit@v5.3.0 | |
with: | |
author_name: Marcus Husar | |
author_email: marcus.husar@gmail.com | |
message: 'Update hosts files for EasyPrivacy filter list.' | |
add: 'easyprivacy/dist' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |