From 71a6a9c5d4465bd6b3a74c6c930e0f3f8469d56f Mon Sep 17 00:00:00 2001 From: TMW <23580812+codeshell@users.noreply.github.com> Date: Mon, 4 May 2026 22:04:03 +0200 Subject: [PATCH 1/2] Create fetch-and-regenerate-lists.yml --- .../workflows/fetch-and-regenerate-lists.yml | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/fetch-and-regenerate-lists.yml diff --git a/.github/workflows/fetch-and-regenerate-lists.yml b/.github/workflows/fetch-and-regenerate-lists.yml new file mode 100644 index 0000000..ce4635e --- /dev/null +++ b/.github/workflows/fetch-and-regenerate-lists.yml @@ -0,0 +1,36 @@ +# This workflow will install Python dependencies, fetch external sources and generate blocklists with a single version of Python + +name: Fetch updates + +on: + schedule: + - cron: '17 11 * * 1-5' + timezone: "Europe/Berlin" + +permissions: + contents: write + +jobs: + run-uodate: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v6 + - name: Set up Python 3.14 + uses: actions/setup-python@v6 + with: + python-version: "3.14" + cache: "pip" + check-latest: false + - name: Install dependencies + run: | + # python -m pip install --upgrade pip + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Update external sources + run: | + python "./scripts/import_from_wiki_gg.py" + python "./scripts/import_from_indie_wiki.py" + - name: Generate blocklists from sources + run: | + python "./scripts/generate_blocklists.py" From a1a67ce177102284d0af7bae818b835228f9ba13 Mon Sep 17 00:00:00 2001 From: codeshell Date: Tue, 5 May 2026 01:29:26 +0200 Subject: [PATCH 2/2] chore: add commit logic to update workflow --- .../workflows/fetch-and-regenerate-lists.yml | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/.github/workflows/fetch-and-regenerate-lists.yml b/.github/workflows/fetch-and-regenerate-lists.yml index ce4635e..b3c9b8d 100644 --- a/.github/workflows/fetch-and-regenerate-lists.yml +++ b/.github/workflows/fetch-and-regenerate-lists.yml @@ -11,12 +11,14 @@ permissions: contents: write jobs: - run-uodate: + fetch-updates: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 + with: + ref: ${{ github.head_ref }} - name: Set up Python 3.14 uses: actions/setup-python@v6 with: @@ -34,3 +36,28 @@ jobs: - name: Generate blocklists from sources run: | python "./scripts/generate_blocklists.py" + - name: Check for Changes + id: check_changes + run: | + if [[ -n "$(git diff --exit-code)" ]]; then + echo "Changes detected." + echo "has_changes=true" >> "$GITHUB_OUTPUT" + else + echo "No changes detected." + echo "has_changes=false" >> "$GITHUB_OUTPUT" + fi + - name: Commit and Push Changes + if: steps.check_changes.outputs.has_changes == 'true' + run: | + # configure user + git config --global user.name "${{ github.actor }}" + git config --global user.email "${{ github.actor }}@users.noreply.github.com" + + # stage any file changes to be committed + git add . + + # make commit with staged changes + git commit -m 'build(lists): auto update blocklists' + + # push the commit back up to source GitHub repository + git push