Reuse TOKEN_FOR_GITEA for the wiki when TOKEN_FOR_GITEA_WIKI is absent
Validate workflows / validate (pull_request) Successful in 15s

The Publish wiki workflow now reads secrets.TOKEN_FOR_GITEA_WIKI ||
secrets.TOKEN_FOR_GITEA, so the existing token can publish the wiki when it
has write:repository. Update the missing-token message, the credentials and
troubleshooting guides, the README, the tests and the affected English
wiki pages with their Danish and Bahasa Malaysia translations.

Task: MIL-005#8
This commit is contained in:
2026-10-10 09:36:47 +08:00
parent 3e18c991ce
commit 2eb852cfc6
15 changed files with 56 additions and 40 deletions
+5 -3
View File
@@ -41,7 +41,7 @@ class TestParseGiteaToken:
with pytest.raises(publish_wiki.WorkflowError) as caught:
publish_wiki.parse_gitea_token(raw)
assert caught.value.category == "configuration"
assert "TOKEN_FOR_GITEA_WIKI" in str(caught.value)
assert "TOKEN_FOR_GITEA" in str(caught.value) or "wiki token" in str(caught.value)
class TestReadPages:
@@ -172,7 +172,7 @@ class TestMain:
monkeypatch.setenv("WIKI_CREDENTIALS", "")
gitea = FakeGitea()
with pytest.raises(publish_wiki.WorkflowError, match="TOKEN_FOR_GITEA_WIKI"):
with pytest.raises(publish_wiki.WorkflowError, match="No token for the wiki"):
run_main(monkeypatch, gitea)
assert gitea.calls == []
@@ -258,5 +258,7 @@ class TestWorkflow:
assert text.count("secrets.TOKEN_FOR_GITEA_WIKI") == 1
steps = document["jobs"]["publish-wiki"]["steps"]
publish_step = steps[-1]
assert publish_step["env"]["WIKI_CREDENTIALS"] == "${{ secrets.TOKEN_FOR_GITEA_WIKI }}"
assert publish_step["env"]["WIKI_CREDENTIALS"] == (
"${{ secrets.TOKEN_FOR_GITEA_WIKI || secrets.TOKEN_FOR_GITEA }}"
)
assert "secrets" not in publish_step["run"]