From ec1b25a09e6dad1c8b5d2485880c11d81285b026 Mon Sep 17 00:00:00 2001 From: hjpalpha <75081997+hjpalpha@users.noreply.github.com> Date: Thu, 5 Mar 2026 00:03:42 +0100 Subject: [PATCH 1/4] Create protect_page_across_wikis.py --- scripts/protect_page_across_wikis.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 scripts/protect_page_across_wikis.py diff --git a/scripts/protect_page_across_wikis.py b/scripts/protect_page_across_wikis.py new file mode 100644 index 00000000000..7b27075f314 --- /dev/null +++ b/scripts/protect_page_across_wikis.py @@ -0,0 +1,24 @@ +import os + +from deploy_util import get_wikis +from protect_page import ( + protect_non_existing_page, + protect_existing_page, + handle_protect_errors, +) + +PAGE_TO_PROTECT = os.getenv("PAGE_TO_PROTECT") + +def main(): + for wiki in get_wikis(): + print(f"::group::Checking {wiki}:{PAGE_TO_PROTECT}") + if wiki == "commons": + protect_existing_page(PAGE_TO_PROTECT, wiki) + else: # commons case + protect_non_existing_page(PAGE_TO_PROTECT, wiki) + print("::endgroup::") + handle_protect_errors() + + +if __name__ == "__main__": + main() From 9148f5fbf10e47dbb0884f2ce151bedf5e039f07 Mon Sep 17 00:00:00 2001 From: hjpalpha <75081997+hjpalpha@users.noreply.github.com> Date: Thu, 5 Mar 2026 00:15:16 +0100 Subject: [PATCH 2/4] Update and rename protect new wiki modules.yml to protect new wiki.yml --- ...ct new wiki modules.yml => protect new wiki.yml} | 13 +++++++++++++ 1 file changed, 13 insertions(+) rename .github/workflows/{protect new wiki modules.yml => protect new wiki.yml} (63%) diff --git a/.github/workflows/protect new wiki modules.yml b/.github/workflows/protect new wiki.yml similarity index 63% rename from .github/workflows/protect new wiki modules.yml rename to .github/workflows/protect new wiki.yml index 6bb1caafa9a..a777f89601d 100644 --- a/.github/workflows/protect new wiki modules.yml +++ b/.github/workflows/protect new wiki.yml @@ -17,11 +17,13 @@ jobs: - uses: actions/checkout@v6 - name: Setup Python + id: setup uses: actions/setup-python@v6 with: python-version: '3.14' - name: Install Python Dependency + id: dependencies run: pip install requests - name: Lua Protect @@ -33,3 +35,14 @@ jobs: WIKI_TO_PROTECT: ${{ github.event.inputs.wiki }} PYTHONUNBUFFERED: 1 run: python3 ./scripts/protect.py + + - name: Template Protect + if: steps.setup.outcome == 'success' && steps.dependencies.outcome == 'success' + env: + WIKI_USER: ${{ secrets.LP_BOTUSER }} + WIKI_PASSWORD: ${{ secrets.LP_BOTPASSWORD }} + WIKI_UA_EMAIL: ${{ secrets.LP_UA_EMAIL }} + WIKI_BASE_URL: ${{ secrets.LP_BASE_URL }} + WIKI_TO_PROTECT: ${{ github.event.inputs.wiki }} + PYTHONUNBUFFERED: 1 + run: python3 ./scripts/protect_templates.py From 3aca74bb8b61733fe71c78f07490573662a564fa Mon Sep 17 00:00:00 2001 From: hjpalpha <75081997+hjpalpha@users.noreply.github.com> Date: Thu, 5 Mar 2026 00:25:41 +0100 Subject: [PATCH 3/4] Update protect new wiki.yml --- .github/workflows/protect new wiki.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/protect new wiki.yml b/.github/workflows/protect new wiki.yml index a777f89601d..1fc47e9b90a 100644 --- a/.github/workflows/protect new wiki.yml +++ b/.github/workflows/protect new wiki.yml @@ -26,7 +26,7 @@ jobs: id: dependencies run: pip install requests - - name: Lua Protect + - name: Template Protect env: WIKI_USER: ${{ secrets.LP_BOTUSER }} WIKI_PASSWORD: ${{ secrets.LP_BOTPASSWORD }} @@ -34,10 +34,10 @@ jobs: WIKI_BASE_URL: ${{ secrets.LP_BASE_URL }} WIKI_TO_PROTECT: ${{ github.event.inputs.wiki }} PYTHONUNBUFFERED: 1 - run: python3 ./scripts/protect.py + run: python3 ./scripts/protect_templates.py - - name: Template Protect - if: steps.setup.outcome == 'success' && steps.dependencies.outcome == 'success' + - name: Lua Protect + #if: steps.setup.outcome == 'success' && steps.dependencies.outcome == 'success' env: WIKI_USER: ${{ secrets.LP_BOTUSER }} WIKI_PASSWORD: ${{ secrets.LP_BOTPASSWORD }} @@ -45,4 +45,4 @@ jobs: WIKI_BASE_URL: ${{ secrets.LP_BASE_URL }} WIKI_TO_PROTECT: ${{ github.event.inputs.wiki }} PYTHONUNBUFFERED: 1 - run: python3 ./scripts/protect_templates.py + run: python3 ./scripts/protect.py From ffa7b9280fe4f786e946d041563ffcd29729da89 Mon Sep 17 00:00:00 2001 From: hjpalpha <75081997+hjpalpha@users.noreply.github.com> Date: Thu, 5 Mar 2026 00:30:14 +0100 Subject: [PATCH 4/4] Update and rename protect new wiki templates.yml to protect page across wikis.yml --- ...iki templates.yml => protect page across wikis.yml} | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) rename .github/workflows/{protect new wiki templates.yml => protect page across wikis.yml} (74%) diff --git a/.github/workflows/protect new wiki templates.yml b/.github/workflows/protect page across wikis.yml similarity index 74% rename from .github/workflows/protect new wiki templates.yml rename to .github/workflows/protect page across wikis.yml index 3b1542f5a2b..8d5030ece43 100644 --- a/.github/workflows/protect new wiki templates.yml +++ b/.github/workflows/protect page across wikis.yml @@ -1,10 +1,10 @@ -name: Protect newly set up wiki +name: Protect page across wikis on: workflow_dispatch: inputs: - wiki: - description: 'Wiki to set up' + page: + description: 'Page to protect (prefix with namespace and use underscores!)' required: true jobs: @@ -30,6 +30,6 @@ jobs: WIKI_PASSWORD: ${{ secrets.LP_BOTPASSWORD }} WIKI_UA_EMAIL: ${{ secrets.LP_UA_EMAIL }} WIKI_BASE_URL: ${{ secrets.LP_BASE_URL }} - WIKI_TO_PROTECT: ${{ github.event.inputs.wiki }} + PAGE_TO_PROTECT: ${{ github.event.inputs.page }} PYTHONUNBUFFERED: 1 - run: python3 ./scripts/protect_templates.py + run: python3 ./scripts/protect_page_across_wikis.py