fixing wiki generation some more #39

Merged
Koda merged 1 commits from wiki into main 2026-07-19 22:48:39 +01:00
2 changed files with 33 additions and 12 deletions
Showing only changes of commit 47da0b9ab3 - Show all commits
+27 -9
View File
@@ -14,7 +14,7 @@ permissions:
code: read code: read
jobs: jobs:
generated-wiki: validate-wiki:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Check out source repository - name: Check out source repository
@@ -29,21 +29,38 @@ jobs:
mkdir -p "$RUNNER_TEMP/openuf-wiki" mkdir -p "$RUNNER_TEMP/openuf-wiki"
python3 source/scripts/docs/generate-wiki.py --output "$RUNNER_TEMP/openuf-wiki" python3 source/scripts/docs/generate-wiki.py --output "$RUNNER_TEMP/openuf-wiki"
python3 source/scripts/docs/generate-wiki.py --check --output "$RUNNER_TEMP/openuf-wiki" python3 source/scripts/docs/generate-wiki.py --check --output "$RUNNER_TEMP/openuf-wiki"
- name: Check out Wiki repository
if: github.event_name != 'pull_request' publish-wiki:
if: gitea.event_name != 'pull_request'
needs: validate-wiki
runs-on: ubuntu-latest
permissions:
code: read
wiki: write
steps:
- name: Check out source repository
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
repository: Koda/openunifi.wiki path: source
token: ${{ secrets.GITEA_TOKEN }} - name: Clone Wiki Git repository
path: wiki env:
GITEA_REPOSITORY: ${{ gitea.repository }}
GITEA_SERVER_URL: ${{ gitea.server_url }}
run: |
set -eu
repository_owner=${GITEA_REPOSITORY%%/*}
repository_name=${GITEA_REPOSITORY##*/}
wiki_name=$(printf '%s' "$repository_name" | tr '[:upper:]' '[:lower:]')
wiki_url="${GITEA_SERVER_URL%/}/${repository_owner}/${wiki_name}.wiki.git"
git clone -- "$wiki_url" wiki
- name: Generate and verify Gitea Wiki pages - name: Generate and verify Gitea Wiki pages
if: github.event_name != 'pull_request'
run: | run: |
python3 source/scripts/docs/generate-wiki.py --output wiki python3 source/scripts/docs/generate-wiki.py --output wiki
python3 source/scripts/docs/generate-wiki.py --check --output wiki python3 source/scripts/docs/generate-wiki.py --check --output wiki
- name: Publish changed Wiki pages - name: Publish changed Wiki pages
if: github.event_name != 'pull_request'
working-directory: wiki working-directory: wiki
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
run: | run: |
set -eu set -eu
git config user.name "openUF documentation bot" git config user.name "openUF documentation bot"
@@ -54,4 +71,5 @@ jobs:
exit 0 exit 0
fi fi
git commit -m "docs: update generated developer wiki" git commit -m "docs: update generated developer wiki"
git push origin HEAD basic_auth=$(printf 'x-access-token:%s' "$GITEA_TOKEN" | base64 | tr -d '\n')
git -c http.extraHeader="Authorization: Basic $basic_auth" push origin HEAD
+6 -3
View File
@@ -71,9 +71,12 @@ so both run natively on ARM and x86 build agents.
Publishing is an explicit authenticated step: `./scripts/docs/publish-wiki.sh`. Publishing is an explicit authenticated step: `./scripts/docs/publish-wiki.sh`.
The script derives the lowercase `.wiki.git` repository URL from `origin`, The script derives the lowercase `.wiki.git` repository URL from `origin`,
checks it out before generating, and accepts an explicit URL override. No checks it out before generating, and accepts an explicit URL override. No
credentials are stored in this repository. The documentation workflow performs credentials are stored in this repository. The documentation workflow clones the
the same two-checkout process and requires `GITEA_TOKEN` to have write access to Wiki Git endpoint directly because it is not a normal API repository. Its
`Koda/openunifi.wiki`. publishing job requests Gitea's `wiki: write` permission for `GITEA_TOKEN` and
passes the token through a transient HTTP authentication header. Repository
Actions settings must allow Wiki write access because Gitea clamps requested
job permissions to the configured maximum.
## Automated releases ## Automated releases