Skip to content
Open
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
35 changes: 35 additions & 0 deletions .github/workflows/protect page across wikis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Protect page across wikis

on:
workflow_dispatch:
inputs:
page:
description: 'Page to protect (prefix with namespace!)'
required: true

jobs:
protect:
if: github.ref_name == github.event.repository.default_branch
name: Protect a given page across all wikis
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6

- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: '3.14'

- name: Install Python Dependency
run: pip install requests

- name: Page 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 }}
PAGE_TO_PROTECT: ${{ github.event.inputs.page }}
PYTHONUNBUFFERED: 1
run: python3 ./scripts/protect_page_across_wikis.py
25 changes: 25 additions & 0 deletions scripts/protect_page_across_wikis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
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:
protect_non_existing_page(PAGE_TO_PROTECT, wiki)
print("::endgroup::")
handle_protect_errors()


if __name__ == "__main__":
main()
Loading