Skip to content
Merged
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
14 changes: 9 additions & 5 deletions .github/workflows/delete dev env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ on:
luadevenv:
description: 'Lua Dev Enviroment name'
required: true
includecommons:
description: 'Include Commons'
type: boolean
default: true
wikis:
description: 'Wikis to remove the dev env from'
type: choice
options:
- all
- all except commons
- commons only
default: all
includesubenvs:
description: 'Include sub envs (e.g. hjp includes hjp2)'
type: boolean
Expand Down Expand Up @@ -40,7 +44,7 @@ jobs:
WIKI_UA_EMAIL: ${{ secrets.LP_UA_EMAIL }}
WIKI_BASE_URL: ${{ secrets.LP_BASE_URL }}
LUA_DEV_ENV_NAME: "dev/${{ github.event.inputs.luadevenv }}"
INCLUDE_COMMONS: ${{ github.event.inputs.includecommons }}
WIKI_SCOPE: ${{ github.event.inputs.wikis }}
INCLUDE_SUB_ENVS: ${{ github.event.inputs.includesubenvs }}
PYTHONUNBUFFERED: 1
run: python3 ./scripts/remove_dev.py
14 changes: 11 additions & 3 deletions scripts/remove_dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from mediawiki_session import MediaWikiSession, MediaWikiSessionError

LUA_DEV_ENV_NAME = os.getenv("LUA_DEV_ENV_NAME")
WIKI_SCOPE = os.getenv("WIKI_SCOPE", "all")

remove_errors: list[str] = list()

Expand Down Expand Up @@ -67,10 +68,17 @@ def search_and_remove(wiki: str):
remove_page(session, page["title"])


def get_target_wikis() -> frozenset[str]:
if WIKI_SCOPE == "commons only":
return frozenset({"commons"})
wikis = get_wikis()
if WIKI_SCOPE == "all except commons":
return wikis - {"commons"}
return wikis


def main():
for wiki in sorted(get_wikis()):
if wiki == "commons" and os.getenv("INCLUDE_COMMONS") != "true":
continue
for wiki in sorted(get_target_wikis()):
search_and_remove(wiki)
if len(remove_errors) == 0:
exit(0)
Expand Down
Loading