update-list #3394
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-list | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: "0 */3 * * *" # UTC | |
jobs: | |
update-list: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: Setup wget and download lists | |
run: | | |
rm -f ip-list.txt | |
rm -rf blocklist | |
mkdir blocklist | |
wget -i urltable -P blocklist/ --wait 7 | |
- name: Process and merge IP lists | |
run: | | |
cd blocklist | |
for file in *; do | |
# Remove comments, leading/trailing whitespace, and empty lines | |
sed 's/#.*//; s/;.*//; s/^[[:space:]]*//; s/[[:space:]]*$//; /^$/d' "$file" >> temp_output | |
done | |
# Sort and remove duplicates | |
sort -u temp_output > ip-list.txt | |
cd .. | |
mv blocklist/ip-list.txt . | |
rm -rf blocklist | |
- name: Remove IPs from exclusion list | |
run: | | |
rm -f exclusion_list.txt | |
rm -rf exclusion | |
mkdir exclusion | |
wget -i urlexclusion -P exclusion/ --wait 7 | |
cd exclusion | |
for file in *; do | |
# Remove comments, leading/trailing whitespace, and empty lines | |
sed 's/#.*//; s/;.*//; s/^[[:space:]]*//; s/[[:space:]]*$//; /^$/d' "$file" >> temp_output2 | |
done | |
# Sort and remove duplicates | |
sort -u temp_output2 > exclusion_list.txt | |
cd .. | |
mv exclusion/exclusion_list.txt . | |
rm -rf exclusion | |
# Remove IP From Exclusion folder | |
if [ -f exclusion_list.txt ]; then | |
grep -vFf exclusion_list.txt ip-list.txt > temp_list.txt | |
mv temp_list.txt ip-list.txt | |
fi | |
- name: Validate IP addresses | |
run: | | |
# Validate IP address | |
sed -i '/^[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}$/!d' ip-list.txt | |
- uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: Update IP list |