Skip to content

Generate Lists

Generate Lists #31

name: Generate Lists
on:
create:
workflow_dispatch:
schedule:
- cron: "30 2 * * 2-5"
jobs:
generate-lists:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
token: ${{ secrets.ACCESS_TOKEN }}
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.91.0
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
- name: Download latest Procon CLI
run: |
# Download the latest Linux binary from releases
LATEST_RELEASE=$(curl -s https://api.github.com/repos/glauberlima/procon-blocklist/releases/latest | jq -r '.assets[] | select(.name | contains("x86_64-unknown-linux-gnu")) | .browser_download_url')
echo "📥 Downloading pre-compiled CLI from: $LATEST_RELEASE"
curl -L -o procon-cli.tar.gz "$LATEST_RELEASE"
tar xzf procon-cli.tar.gz
chmod +x procon-cli
- name: Configure Git
run: |
git config user.name github-actions
git config user.email [email protected]
- name: Generate lists with Procon CLI
run: |
cd data
../procon-cli generate --format adblock --output adblock.txt
../procon-cli generate --format hosts --output hosts
- name: Check for changes
id: check_changes
run: |
# Extract only site listings (ignore headers with timestamps)
grep '^||' data/adblock.txt > /tmp/adblock_sites.txt 2>/dev/null || true
grep '^0\.0\.0\.0' data/hosts > /tmp/hosts_sites.txt 2>/dev/null || true
# Get previous versions from git
git show HEAD:data/adblock.txt | grep '^||' > /tmp/adblock_sites_old.txt 2>/dev/null || true
git show HEAD:data/hosts | grep '^0\.0\.0\.0' > /tmp/hosts_sites_old.txt 2>/dev/null || true
# Compare only the site listings (ignore timestamp in headers)
if ! diff -q /tmp/adblock_sites.txt /tmp/adblock_sites_old.txt >/dev/null 2>&1 || \
! diff -q /tmp/hosts_sites.txt /tmp/hosts_sites_old.txt >/dev/null 2>&1; then
echo "changes=true" >> $GITHUB_OUTPUT
echo "📝 Changes detected in site listings"
else
echo "changes=false" >> $GITHUB_OUTPUT
echo "✅ No changes in site listings (only timestamp updated)"
fi
- name: Commit and push changes
if: steps.check_changes.outputs.changes == 'true'
run: |
git add data/adblock.txt data/hosts
git commit -m "📋 Update lists - $(date +"%d/%m/%Y %H:%M:%S (GMT%:z)")"
git push