Document how a repository opts in to wiki publishing
Validate workflows / validate (pull_request) Successful in 16s
Validate workflows / validate (pull_request) Successful in 16s
Describe the wiki/.publish marker and the prune word, the per-organisation TOKEN_FOR_GITEA_WIKI without fallback, and the new messages in the onboarding, credentials and troubleshooting guides and the README. Add the capability row and regenerate the five English wiki pages with their Danish and Bahasa Malaysia translations. Task: MIL-006#5
This commit is contained in:
+14
-12
@@ -56,27 +56,29 @@ 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 `TOKEN_FOR_GITEA_WIKI`
|
||||
when that secret exists and otherwise reuses `TOKEN_FOR_GITEA`.
|
||||
The workflow **Publish wiki** copies `wiki/` to the Gitea wiki of a repository
|
||||
that has opted in with `wiki/.publish` (see [onboarding.md](onboarding.md)). It
|
||||
uses its own secret, so the metadata sync token stays read-only.
|
||||
|
||||
| Secret | Content | Used for |
|
||||
| --- | --- | --- |
|
||||
| `TOKEN_FOR_GITEA_WIKI` (optional) | The Gitea token, nothing else | Writing the wiki pages of this repository |
|
||||
| `TOKEN_FOR_GITEA_WIKI` | The Gitea token, nothing else | Writing the wiki pages of the repositories of an organization that opt in |
|
||||
|
||||
- The token that is used needs scope `write:repository`, and its user needs
|
||||
write access to this repository. Gitea has no wiki-only scope.
|
||||
- `TOKEN_FOR_GITEA` is documented above with `read:repository` only. Reusing it
|
||||
for the wiki means raising its scope, which also gives the metadata sync
|
||||
write access. A separate `TOKEN_FOR_GITEA_WIKI` for a dedicated user keeps
|
||||
the sync token read-only. S05 decides which, and S03 stores the secret.
|
||||
- Store it as a secret of the organization of each repository that publishes.
|
||||
There is no fallback to `TOKEN_FOR_GITEA`: a repository that opted in and has
|
||||
no such secret fails with a configuration error, and a repository that did
|
||||
not opt in does not need it.
|
||||
- The token needs scope `write:repository`, and its user needs write access to
|
||||
the repositories. Gitea has no wiki-only scope, so create the token for a
|
||||
dedicated user. 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.
|
||||
- Pages that are in `wiki/` are always overwritten from it, so a change made
|
||||
in the Gitea web UI is lost on the next publish. Pages that are only in the
|
||||
wiki are removed only when `wiki/.publish` contains the word `prune`.
|
||||
|
||||
## Rotating a token
|
||||
|
||||
|
||||
@@ -43,6 +43,27 @@ Delivery is automatic, so a repository needs no copy of the workflow. Secrets ar
|
||||
and topics.
|
||||
7. If it fails, use [troubleshooting.md](troubleshooting.md).
|
||||
|
||||
## Publish a wiki (optional)
|
||||
|
||||
The **Publish wiki** workflow copies the Markdown pages in `wiki/` to the
|
||||
repository wiki when a change to `wiki/` is merged to `main`. It is delivered
|
||||
like the sync workflow, but it writes only where a repository opts in.
|
||||
|
||||
1. Enable the wiki in the repository settings.
|
||||
2. Add Markdown pages to `wiki/`. The file name is the page name: `Home.md` is
|
||||
the home page.
|
||||
3. Add the marker `wiki/.publish`. Leave it empty to create and update pages
|
||||
only. Put the single word `prune` in it to also delete wiki pages that are
|
||||
not in `wiki/`, so the wiki always equals the folder.
|
||||
4. Store `TOKEN_FOR_GITEA_WIKI` as a secret of the repository's organization,
|
||||
using the scope in [credentials.md](credentials.md).
|
||||
5. Merge the change to `main`. The log must end with `Published <n> page(s) to
|
||||
the wiki of <owner>/<repo>`.
|
||||
|
||||
A repository without `wiki/.publish` is skipped with the line `No
|
||||
wiki/.publish marker in <owner>/<repo>`: nothing is written and no secret is
|
||||
needed.
|
||||
|
||||
## Runners
|
||||
|
||||
| Item | Value |
|
||||
|
||||
@@ -26,7 +26,8 @@ never starts, or stops before the step) is a **runner** problem.
|
||||
| `TOKEN_FOR_GITEA is missing or empty.` | configuration | Add the secret |
|
||||
| `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 |
|
||||
| `No token for the wiki: set TOKEN_FOR_GITEA_WIKI, or TOKEN_FOR_GITEA.` | configuration | Wiki publishing only: add one of the secrets (see [credentials.md](credentials.md)) |
|
||||
| `TOKEN_FOR_GITEA_WIKI is missing or empty.` | configuration | Wiki publishing only: the repository opted in with `wiki/.publish` but its organization has no such secret; store it (see [credentials.md](credentials.md)) |
|
||||
| `wiki/.publish may only be empty or contain the word 'prune'.` | configuration | Wiki publishing only: leave the marker empty, or put only the word `prune` in it |
|
||||
| `... HTTP 403 ...` while publishing the wiki | permissions | Wiki publishing only: the token needs `write:repository` and write access to this repository |
|
||||
| `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 |
|
||||
@@ -51,6 +52,14 @@ settings.
|
||||
synced.` The run succeeds but nothing was synced. Check that the Gitea
|
||||
version supports the push mirror API and re-run.
|
||||
|
||||
`No wiki/.publish marker in <owner>/<repo>; wiki publishing is not enabled for
|
||||
this repository.` The Publish wiki run succeeds and writes nothing. The
|
||||
repository has not opted in; add `wiki/.publish` if it should publish.
|
||||
|
||||
`<n> page(s) are in the wiki but not in wiki/ and were kept; put the word
|
||||
'prune' in wiki/.publish to delete them.` The run succeeds. Pages that exist
|
||||
only in the wiki are left alone unless the marker contains `prune`.
|
||||
|
||||
## Runner problems
|
||||
|
||||
See the [Runners](onboarding.md#runners) section. In short: if the run stays
|
||||
|
||||
Reference in New Issue
Block a user