From 582067c2f829b154873011350a13b672faaa1b87 Mon Sep 17 00:00:00 2001 From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com> Date: Fri, 10 Jul 2026 15:04:52 +0900 Subject: [PATCH 01/11] add requirements.txt --- requirements.txt | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000000..81c9577e43b --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +requests==2.34.2 +python-dotenv==1.2.2 From 117bed17791b8b690d5e8738294060e450783dcf Mon Sep 17 00:00:00 2001 From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com> Date: Fri, 10 Jul 2026 15:30:21 +0900 Subject: [PATCH 02/11] add deploy tasks --- .vscode/tasks.json | 47 ++++++++++++++++++++++++++++++++++++++++++++++ scripts/deploy.py | 31 ++++++++++++++++++++++++++++-- 2 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 .vscode/tasks.json diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 00000000000..80739cdfd93 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,47 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Deploy current file", + "type": "shell", + "command": "venv/bin/python3", + "windows": { + "command": "venv/Scripts/python.exe" + }, + "args": [ + "scripts/deploy.py", + "${relativeFile}" + ], + "options": { + "env": { + "LUA_DEV_ENV_NAME": "/dev/${input:devEnvironment}" + } + }, + "problemMatcher": [] + }, + { + "label": "Deploy all changed file", + "type": "shell", + "command": "venv/bin/python3", + "windows": { + "command": "venv/Scripts/python.exe" + }, + "args": [ + "scripts/deploy.py", + ], + "options": { + "env": { + "LUA_DEV_ENV_NAME": "/dev/${input:devEnvironment}" + } + }, + "problemMatcher": [] + } + ], + "inputs": [ + { + "id": "devEnvironment", + "type": "promptString", + "description": "Lua Dev Enviroment name" + } + ] +} \ No newline at end of file diff --git a/scripts/deploy.py b/scripts/deploy.py index dffd1854605..535d13d2a13 100644 --- a/scripts/deploy.py +++ b/scripts/deploy.py @@ -2,10 +2,13 @@ import os import pathlib import re +import subprocess import sys from typing import Iterable +from dotenv import load_dotenv + from deploy_util import ( get_git_deploy_reason, read_file_from_path, @@ -13,6 +16,8 @@ ) from mediawiki_session import MediaWikiSession +load_dotenv() + HEADER_PATTERN = re.compile( r"\A---\n" r"-- @Liquipedia\n" r"-- page=(?P[^\n]*)\n" ) @@ -46,11 +51,33 @@ def main(): all_modules_deployed = True lua_files: Iterable[pathlib.Path] git_deploy_reason: str - if len(sys.argv[1:]) == 0: + assert ( + os.getenv("LUA_DEV_ENV_NAME") is None + or os.getenv("LUA_DEV_ENV_NAME") != "/dev/" + ), f"Invalid dev environment: {os.getenv('LUA_DEV_ENV_NAME')}" + if len(sys.argv[1:]) == 0 and os.getenv("LUA_DEV_ENV_NAME") is None: lua_files = pathlib.Path("./lua/wikis/").rglob("*.lua") git_deploy_reason = "Automated Weekly Re-Sync" else: - lua_files = [pathlib.Path(arg) for arg in sys.argv[1:]] + if len(sys.argv[1:]) == 0: + lua_files = [ + pathlib.Path(changed_file) + for changed_file in subprocess.check_output( + [ + "git", + "diff", + "--name-only", + "--diff-filter=d", + "main", + "lua/wikis/*", + ] + ) + .decode() + .strip() + .splitlines() + ] + else: + lua_files = [pathlib.Path(arg) for arg in sys.argv[1:]] git_deploy_reason = get_git_deploy_reason() for wiki, files in itertools.groupby(sorted(lua_files), lambda path: path.parts[2]): From f19e4a4d739b0ecec146898bda7079f06309391c Mon Sep 17 00:00:00 2001 From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com> Date: Fri, 10 Jul 2026 15:32:43 +0900 Subject: [PATCH 03/11] cache python deps --- .github/workflows/delete dev env.yml | 3 ++- .github/workflows/deploy test.yml | 3 ++- .github/workflows/deploy.yml | 3 ++- .github/workflows/protect new wiki.yml | 3 ++- .github/workflows/protect page across wikis.yml | 3 ++- .github/workflows/scheduled.yml | 3 ++- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/delete dev env.yml b/.github/workflows/delete dev env.yml index f850adca2e1..89e24d530a7 100644 --- a/.github/workflows/delete dev env.yml +++ b/.github/workflows/delete dev env.yml @@ -28,9 +28,10 @@ jobs: uses: actions/setup-python@v6 with: python-version: '3.14' + cache: 'pip' - name: Install Python Dependency - run: pip install requests + run: pip install -r requirements.txt - name: Remove Lua Dev Env Modules env: diff --git a/.github/workflows/deploy test.yml b/.github/workflows/deploy test.yml index fe509c4d9ae..9288b549896 100644 --- a/.github/workflows/deploy test.yml +++ b/.github/workflows/deploy test.yml @@ -32,10 +32,11 @@ jobs: uses: actions/setup-python@v6 with: python-version: '3.14' + cache: 'pip' - name: Install Python Dependency if: steps.changed-files.outputs.any_changed == 'true' - run: pip install requests + run: pip install -r requirements.txt - name: Personal Lua Deploy if: steps.changed-files.outputs.any_changed == 'true' diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ae543ea957e..e4cbbcccad2 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -34,10 +34,11 @@ jobs: uses: actions/setup-python@v6 with: python-version: '3.14' + cache: 'pip' - name: Install Python Dependency if: steps.res-changed-files.outputs.any_changed == 'true' || steps.lua-changed-files.outputs.any_changed == 'true' - run: pip install requests + run: pip install -r requirements.txt - name: Resource Deploy if: steps.res-changed-files.outputs.any_changed == 'true' diff --git a/.github/workflows/protect new wiki.yml b/.github/workflows/protect new wiki.yml index 790e482f590..77614d8ae8c 100644 --- a/.github/workflows/protect new wiki.yml +++ b/.github/workflows/protect new wiki.yml @@ -20,10 +20,11 @@ jobs: uses: actions/setup-python@v6 with: python-version: '3.14' + cache: 'pip' - name: Install Python Dependency id: dependencies - run: pip install requests + run: pip install -r requirements.txt - name: Template Protect env: diff --git a/.github/workflows/protect page across wikis.yml b/.github/workflows/protect page across wikis.yml index 6f9674247e8..2b0f45451b2 100644 --- a/.github/workflows/protect page across wikis.yml +++ b/.github/workflows/protect page across wikis.yml @@ -20,9 +20,10 @@ jobs: uses: actions/setup-python@v6 with: python-version: '3.14' + cache: 'pip' - name: Install Python Dependency - run: pip install requests + run: pip install -r requirements.txt - name: Page Protect env: diff --git a/.github/workflows/scheduled.yml b/.github/workflows/scheduled.yml index 0d2d29c3d8b..38225b42d7c 100644 --- a/.github/workflows/scheduled.yml +++ b/.github/workflows/scheduled.yml @@ -19,9 +19,10 @@ jobs: uses: actions/setup-python@v6 with: python-version: '3.14' + cache: 'pip' - name: Install Python Dependency - run: pip install requests + run: pip install -r requirements.txt - name: Resource Deploy env: From 17b2805749f4b459ac2dca244e9108e92ade010e Mon Sep 17 00:00:00 2001 From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com> Date: Fri, 10 Jul 2026 15:40:11 +0900 Subject: [PATCH 04/11] eof --- .vscode/tasks.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 80739cdfd93..5ff5f7129ff 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -44,4 +44,4 @@ "description": "Lua Dev Enviroment name" } ] -} \ No newline at end of file +} From b5bec7d6cb46a680a8244f641ab78f30463862eb Mon Sep 17 00:00:00 2001 From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com> Date: Fri, 10 Jul 2026 16:07:41 +0900 Subject: [PATCH 05/11] make base ref configurable --- .vscode/tasks.json | 12 ++++++++++-- scripts/deploy.py | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 5ff5f7129ff..7b07681f4af 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -14,7 +14,8 @@ ], "options": { "env": { - "LUA_DEV_ENV_NAME": "/dev/${input:devEnvironment}" + "LUA_DEV_ENV_NAME": "/dev/${input:devEnvironment}", + "LUA_DEV_BASE": "${input:devBaseRef}" } }, "problemMatcher": [] @@ -31,7 +32,8 @@ ], "options": { "env": { - "LUA_DEV_ENV_NAME": "/dev/${input:devEnvironment}" + "LUA_DEV_ENV_NAME": "/dev/${input:devEnvironment}", + "LUA_DEV_BASE_REF": "${input:devBaseRef}" } }, "problemMatcher": [] @@ -42,6 +44,12 @@ "id": "devEnvironment", "type": "promptString", "description": "Lua Dev Enviroment name" + }, + { + "id": "devBaseRef", + "type": "promptString", + "description": "Base ref to compare against for dev deployment", + "default": "main" } ] } diff --git a/scripts/deploy.py b/scripts/deploy.py index 535d13d2a13..285f2016f8e 100644 --- a/scripts/deploy.py +++ b/scripts/deploy.py @@ -68,7 +68,7 @@ def main(): "diff", "--name-only", "--diff-filter=d", - "main", + os.getenv("LUA_DEV_BASE_REF") or "main", "lua/wikis/*", ] ) From 0b5c61df46658172773a573edee9e2894f92379a Mon Sep 17 00:00:00 2001 From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com> Date: Fri, 10 Jul 2026 16:08:33 +0900 Subject: [PATCH 06/11] yikes --- .vscode/tasks.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 7b07681f4af..f942fbb1add 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -15,7 +15,7 @@ "options": { "env": { "LUA_DEV_ENV_NAME": "/dev/${input:devEnvironment}", - "LUA_DEV_BASE": "${input:devBaseRef}" + "LUA_DEV_BASE_REF": "${input:devBaseRef}" } }, "problemMatcher": [] From 2b8e348e0a03056e38faab075cbad5acd181ca56 Mon Sep 17 00:00:00 2001 From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com> Date: Fri, 10 Jul 2026 16:13:33 +0900 Subject: [PATCH 07/11] use interpreter path from python extension --- .vscode/tasks.json | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index f942fbb1add..ee0291cc784 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -4,10 +4,7 @@ { "label": "Deploy current file", "type": "shell", - "command": "venv/bin/python3", - "windows": { - "command": "venv/Scripts/python.exe" - }, + "command": "${command:python.interpreterPath}", "args": [ "scripts/deploy.py", "${relativeFile}" @@ -23,10 +20,7 @@ { "label": "Deploy all changed file", "type": "shell", - "command": "venv/bin/python3", - "windows": { - "command": "venv/Scripts/python.exe" - }, + "command": "${command:python.interpreterPath}", "args": [ "scripts/deploy.py", ], From 6f73b6d476088b6a5134adfde67cdb271baefaee Mon Sep 17 00:00:00 2001 From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com> Date: Fri, 10 Jul 2026 16:18:55 +0900 Subject: [PATCH 08/11] add .env.example --- .env.example | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 00000000000..231f80a52f4 --- /dev/null +++ b/.env.example @@ -0,0 +1,5 @@ +WIKI_BASE_URL=https://liquipedia.net +WIKI_UA_EMAIL=john.doe@liquipedia.is.awesome +WIKI_USER=YourBotAccount@BotName +WIKI_PASSWORD=YourBotPassword +DRY_RUN=0 From cb1db8c9e25c52121f66968d8c1e593a5c3efce1 Mon Sep 17 00:00:00 2001 From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com> Date: Fri, 10 Jul 2026 16:27:43 +0900 Subject: [PATCH 09/11] use system-aware path separator --- .vscode/tasks.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index ee0291cc784..d788432c8cc 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -6,7 +6,7 @@ "type": "shell", "command": "${command:python.interpreterPath}", "args": [ - "scripts/deploy.py", + "scripts${/}deploy.py", "${relativeFile}" ], "options": { @@ -22,7 +22,7 @@ "type": "shell", "command": "${command:python.interpreterPath}", "args": [ - "scripts/deploy.py", + "scripts${/}deploy.py", ], "options": { "env": { From 8ab9775ab4d5733d1692da89740cf4d79cf2c3f0 Mon Sep 17 00:00:00 2001 From: Eetu Rantanen Date: Fri, 10 Jul 2026 13:03:36 +0300 Subject: [PATCH 10/11] document flow --- README.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/README.md b/README.md index 74287267068..5e49ead1aab 100644 --- a/README.md +++ b/README.md @@ -144,12 +144,58 @@ Trusted contributers may be given the privilege of directly branching within the ### Testing your branch +Deploying your branch to a dev environment publishes your modules to sandbox pages (suffixed with `/dev/`) on the wiki, so you can render and test them without touching the live pages. + +#### Via a GitHub Action + To test your changes in action, you can run the GitHub Action called "Personal Deploy" defined in `.github/workflows/deploy test.yml`. You can do it either through the GitHub interface or with the GitHub CLI tools: `gh workflow run 'deploy test.yml' -r -f luadevenv=` To check the workflow progress from the CLI, you can run: `gh run list --workflow="deploy test.yml"` +#### From your machine + +You can also run the deploy script locally. This works from any editor — the repo ships a Visual Studio Code integration, and every other editor can call the same script directly. + +**One-time setup:** + +1. Install the Python dependencies: `pip install -r requirements.txt` +2. Copy `.env.example` to `.env` and fill in your bot account credentials. `.env` is git-ignored — never commit it. + +``` +WIKI_BASE_URL=https://liquipedia.net +WIKI_UA_EMAIL=you@example.com +WIKI_USER=YourBotAccount@BotName +WIKI_PASSWORD=YourBotPassword +DRY_RUN=0 +``` + +**Running it:** + +```bash +# Deploy specific files +python scripts/deploy.py lua/wikis/commons/SomeModule.lua [more files...] + +# Deploy every file changed on your branch under lua/wikis/ +python scripts/deploy.py +``` + +The behaviour is driven by environment variables (set them in `.env` or per-invocation): + +| Variable | Purpose | +| --- | --- | +| `LUA_DEV_ENV_NAME` | Sandbox suffix, e.g. `/dev/myenv`. Appended to every deployed page name. **Set this for all dev testing** — without it, deploys go to the live module pages. Also required to enable the no-argument "all changed files" mode. | +| `LUA_DEV_BASE_REF` | Ref that the no-argument mode diffs against to find changed files. Defaults to `main`. | +| `DRY_RUN` | Set to `1` to run the full flow without writing to the wiki. | +| `WIKI_USER` / `WIKI_PASSWORD` / `WIKI_BASE_URL` / `WIKI_UA_EMAIL` | Bot credentials and target wiki (see setup above). | + +> **Note:** running `python scripts/deploy.py` with no arguments **and** no `LUA_DEV_ENV_NAME` triggers a full re-sync of every module to the live wiki — this is the automated weekly-resync path and is not what you want for testing a branch. + +**Visual Studio Code:** the repo includes tasks in `.vscode/tasks.json` — run *Tasks: Run Task* and pick **Deploy current file** or **Deploy all changed file**. Both prompt for the dev environment name and the base ref. + +**Other editors:** bind a command to `python scripts/deploy.py` with the environment above. For example, a Neovim mapping can shell out to `python scripts/deploy.py ` with `LUA_DEV_ENV_NAME=/dev/` set on the job's environment. + ## Support If you encounter any issues or have questions, feel free to open an issue on GitHub or reach out to the Liquipedia community for support. From e4babe504fb885341a5da3690bab73deccc6a1d6 Mon Sep 17 00:00:00 2001 From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com> Date: Fri, 10 Jul 2026 20:13:08 +0900 Subject: [PATCH 11/11] add prefix check --- scripts/deploy.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/deploy.py b/scripts/deploy.py index 285f2016f8e..210a650ceba 100644 --- a/scripts/deploy.py +++ b/scripts/deploy.py @@ -51,9 +51,9 @@ def main(): all_modules_deployed = True lua_files: Iterable[pathlib.Path] git_deploy_reason: str - assert ( - os.getenv("LUA_DEV_ENV_NAME") is None - or os.getenv("LUA_DEV_ENV_NAME") != "/dev/" + assert os.getenv("LUA_DEV_ENV_NAME") is None or ( + os.getenv("LUA_DEV_ENV_NAME") != "/dev/" + and os.getenv("LUA_DEV_ENV_NAME").startswith("/dev/") ), f"Invalid dev environment: {os.getenv('LUA_DEV_ENV_NAME')}" if len(sys.argv[1:]) == 0 and os.getenv("LUA_DEV_ENV_NAME") is None: lua_files = pathlib.Path("./lua/wikis/").rglob("*.lua")