chore: sync wiki/ folder to GitHub Wiki via Actions workflow#6
Conversation
Agent-Logs-Url: https://github.com/Foscat/Interactive-Surface-CSS/sessions/0105a7b4-c6e8-44bb-b424-195a22627140 Co-authored-by: Foscat <40616718+Foscat@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds automation to keep the repository’s wiki/ folder in sync with the GitHub Wiki (separate .wiki.git repo) via a GitHub Actions workflow, triggered on main updates affecting wiki/** and via manual dispatch.
Changes:
- Introduces a new Actions workflow to clone the GitHub Wiki repo and sync content from
wiki/usingrsync. - Excludes
wiki/WIKI_SETUP.mdfrom being published to the GitHub Wiki. - Commits and pushes wiki changes only when there are actual diffs.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Copy wiki files, excluding the setup notes file | ||
| rsync -av --delete \ |
There was a problem hiding this comment.
rsync --delete will delete files in wiki-repo/ that don't exist in wiki/, including the cloned repo’s .git/ directory. That will break subsequent git add/commit/push (or leave the repo in a non-git state). Exclude .git/ from the rsync (or run rsync from inside wiki-repo while explicitly preserving .git/).
| # Copy wiki files, excluding the setup notes file | |
| rsync -av --delete \ | |
| # Copy wiki files while preserving the cloned repository metadata | |
| rsync -av --delete \ | |
| --exclude=".git/" \ |
| - name: Push wiki folder to GitHub Wiki | ||
| run: | | ||
| git config --global user.name "github-actions[bot]" | ||
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
|
|
||
| WIKI_REPO="https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.wiki.git" | ||
|
|
||
| git clone "$WIKI_REPO" wiki-repo | ||
|
|
There was a problem hiding this comment.
The workflow embeds GITHUB_TOKEN directly in the clone URL. If git clone fails (e.g., wiki repo not initialized) the error output can include the full URL, potentially exposing the token in logs. Prefer using actions/checkout with repository: ${{ github.repository }}.wiki and token: ${{ github.token }} (or otherwise avoid putting credentials in the URL).
| - name: Push wiki folder to GitHub Wiki | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| WIKI_REPO="https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.wiki.git" | |
| git clone "$WIKI_REPO" wiki-repo | |
| - name: Checkout wiki repository | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: ${{ github.repository }}.wiki | |
| token: ${{ github.token }} | |
| path: wiki-repo | |
| - name: Push wiki folder to GitHub Wiki | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" |
| git config --global user.name "github-actions[bot]" | ||
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
|
|
||
| WIKI_REPO="https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.wiki.git" | ||
|
|
||
| git clone "$WIKI_REPO" wiki-repo |
There was a problem hiding this comment.
Using git config --global modifies the runner’s global git config for the rest of the job. Prefer configuring the cloned wiki repo only (e.g., git -C wiki-repo config user.name/...) to keep the step self-contained.
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| WIKI_REPO="https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.wiki.git" | |
| git clone "$WIKI_REPO" wiki-repo | |
| WIKI_REPO="https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.wiki.git" | |
| git clone "$WIKI_REPO" wiki-repo | |
| git -C wiki-repo config user.name "github-actions[bot]" | |
| git -C wiki-repo config user.email "github-actions[bot]@users.noreply.github.com" |
|
@copilot apply changes based on the comments in this thread |
Agent-Logs-Url: https://github.com/Foscat/Interactive-Surface-CSS/sessions/290f6e19-a1ec-4fb1-a487-4edf806675aa Co-authored-by: Foscat <40616718+Foscat@users.noreply.github.com>
Applied all three review suggestions in d556a44:
|
|
@copilot apply changes based on the comments in this thread |
All three changes were already applied in d556a44 — the current file has |
Wiki content existed in
wiki/in the main repo but never reached the GitHub Wiki tab because GitHub's wiki is a separate git repository that requires an explicit push.Summary
Adds a GitHub Actions workflow that checks out the
.wiki.gitrepo viaactions/checkout@v4and syncs thewiki/folder into it usingrsync(excludingWIKI_SETUP.mdand.git/), then commits and pushes any changes. Triggers on pushes tomainthat touchwiki/**, and supports manual dispatch.Security and hygiene improvements based on review feedback:
actions/checkout@v4usingtoken: ${{ github.token }}— credentials are never embedded in a URL that could be exposed in error logs.git -C wiki-repo configto scope it to the wiki clone only, not the runner's global git config.rsync --deleteexcludes.git/to prevent wiping the cloned repo's git metadata before the commit/push steps run.Scope
Validation
Workflow logic verified by inspection. No CSS, JS, or package changes — standard linting and test runs are not applicable here.
# No applicable npm commands for a workflow-only changeAPI and Behavior Impact
Documentation
Notes
One-time manual bootstrap required: GitHub only initializes the wiki git repo after a first page is created via the UI. Go to the Wiki tab → "Create the first page" → save anything. After that, merge this PR and trigger the workflow (manually or via a
wiki/change onmain) to fully populate the wiki.The workflow uses
GITHUB_TOKENwithcontents: write— no extra secrets needed.