Add tools/publish_wiki.py and the Publish wiki workflow, which make the Gitea wiki equal wiki/ through the wiki REST API when a change to wiki/ is merged to main. It needs its own secret TOKEN_FOR_GITEA_WIKI, refuses an empty source and checks that the English pages are current first. Document the secret in the credentials and troubleshooting guides and regenerate the affected wiki pages. Task: MIL-005#8
This commit is contained in:
@@ -56,6 +56,28 @@ credentials.` Failures start with a category such as `[credentials]` or
|
||||
`[permissions]`; see [troubleshooting.md](troubleshooting.md). No secret value
|
||||
is ever printed.
|
||||
|
||||
## Wiki publishing secret
|
||||
|
||||
The workflow **Publish wiki** (this repository only) copies `wiki/` to the Gitea
|
||||
wiki when a change to `wiki/` is merged to `main`. It uses its own secret so
|
||||
that the metadata sync tokens never get write access.
|
||||
|
||||
| Secret | Content | Used for |
|
||||
| --- | --- | --- |
|
||||
| `TOKEN_FOR_GITEA_WIKI` | A bare token, a JSON string, or JSON with `GITEA_TOKEN` | Writing the wiki pages of this repository |
|
||||
|
||||
- A Gitea personal access token with scope `write:repository`. Gitea has no
|
||||
wiki-only scope, so create the token for a dedicated user that has write
|
||||
access to this repository only. S05 approves the scope and S03 stores the
|
||||
secret.
|
||||
- Calls made: `GET /repos/{owner}/{repo}`, `GET /repos/{owner}/{repo}/wiki/pages`,
|
||||
`GET`, `POST` and `PATCH /repos/{owner}/{repo}/wiki/...` and, for a page that
|
||||
no longer exists in `wiki/`, `DELETE /repos/{owner}/{repo}/wiki/page/{name}`.
|
||||
- The wiki must be enabled in the repository settings. The workflow refuses to
|
||||
run when it is not.
|
||||
- The wiki always equals `wiki/`: pages edited or added in the Gitea web UI are
|
||||
overwritten or removed on the next publish.
|
||||
|
||||
## Rotating a token
|
||||
|
||||
1. Create the new token with the permissions above.
|
||||
|
||||
@@ -30,6 +30,9 @@ never starts, or stops before the step) is a **runner** problem.
|
||||
| `TOKEN_FOR_GITEA must contain a non-empty GITEA_TOKEN.` | configuration | The JSON form needs a `GITEA_TOKEN` key |
|
||||
| `Could not determine the Gitea source repository.` | configuration | The run has no repository name; report as a defect |
|
||||
| `Expected at most one GitHub push mirror ... found N` | configuration | Keep one GitHub push mirror |
|
||||
| `TOKEN_FOR_GITEA_WIKI is missing or empty.` | configuration | Wiki publishing only: add the secret (see [credentials.md](credentials.md)) |
|
||||
| `The wiki is not enabled on <repo>` | configuration | Wiki publishing only: enable the wiki in the repository settings |
|
||||
| `The wiki source directory ... has no Markdown pages` | configuration | Wiki publishing only: `wiki/` is empty or missing; nothing was changed |
|
||||
| `Could not determine the GitHub owner and repository ...` | configuration | The mirror address must look like `https://github.com/<owner>/<repo>.git` |
|
||||
| `Gitea API request failed with HTTP 401` | credentials | Create a new Gitea token and update `TOKEN_FOR_GITEA` |
|
||||
| `GitHub API request failed with HTTP 401` | credentials | Create a new GitHub token and update `CREDENTIALS_FOR_GITHUB` |
|
||||
|
||||
Reference in New Issue
Block a user