Update Sefinek's lists #5
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 Sefinek's lists | |
on: | |
schedule: # https://crontab.guru | |
- cron: '0 10 * * *' # At 10:00. | |
workflow_dispatch: | |
jobs: | |
sefin-lists: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
ref: main | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22.x | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm ci | |
- name: Download lists | |
run: node scripts/generate/file-processor/download.js --expose-gc | |
- name: Generate lists | |
run: node scripts/generate/file-processor/generate.js | |
- name: Regex check | |
run: node scripts/generate/file-processor/regex.js | |
- name: Generate header | |
run: node scripts/generate/file-processor/header.js | |
- name: Prepare templates | |
run: node scripts/prepare-templates.js | |
- name: Remove duplicates from templates | |
run: node scripts/remove-duplicates.js | |
- name: Remove domains that are on the whitelist | |
run: node scripts/whitelist.js | |
- name: Count domains | |
run: node scripts/update-number-of-domains.js | |
- name: Run git pull | |
run: git pull origin main | |
- name: Add files to staging | |
run: git add . | |
- name: Commit and push changes | |
run: | | |
git config user.name "Sefinek Actions" | |
git config user.email "[email protected]" | |
if [ -n "$(git status -s)" ]; then | |
MODIFIED_FILES=$(git diff --name-only HEAD | grep -v '^cache/') | |
FILE_COUNT=$(echo "$MODIFIED_FILES" | wc -l) | |
if [ "$FILE_COUNT" -gt 0 ]; then | |
git commit -am "Update of Sefinek's lists [$FILE_COUNT files]" -m "$MODIFIED_FILES" | |
git push origin main | |
else | |
echo "Canceled. No files to commit after excluding cache/ files." | |
fi | |
else | |
echo "Canceled. No changes to commit." | |
fi |