Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,27 @@ 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: Template Protect
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

- name: Lua Protect
#if: steps.setup.outcome == 'success' && steps.dependencies.outcome == 'success'
env:
WIKI_USER: ${{ secrets.LP_BOTUSER }}
WIKI_PASSWORD: ${{ secrets.LP_BOTPASSWORD }}
Expand Down
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
24 changes: 24 additions & 0 deletions scripts/protect_page_across_wikis.py
Original file line number Diff line number Diff line change
@@ -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()
Loading