Use GitHub Actions to let contributors open PRs for wiki pages
jcbhmr opened this issue · 2 comments
Something like https://github.com/Andrew-Chen-Wang/github-wiki-action or https://github.com/spenserblack/actions-wiki
name: Publish wiki
on:
push:
branches: [main]
paths:
- wiki/**
- .github/workflows/publish-wiki.yml
concurrency:
group: publish-wiki
cancel-in-progress: true
permissions:
contents: write
jobs:
publish-wiki:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: Andrew-Chen-Wang/github-wiki-action@v4
If you really want to, you can also sync in reverse (wiki to repo)
name: Pull wiki
on:
gollum:
push:
branches: main
paths: .github/workflows/pull-wiki.yml
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
pull-wiki:
permissions:
contents: write
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: |
export GIT_DIR=$(mktemp -d)
trap 'rm -rf "$GIT_DIR"' SIGINT SIGTERM ERR EXIT
export GIT_WORK_TREE=wiki
git clone https://github.com/jcbhmr/.github.wiki.git "$GIT_DIR" --bare
git config --unset core.bare
git reset --hard
- uses: EndBug/add-and-commit@v9
with:
message: '[skip actions] Pull wiki'
Hey, thanks for the suggestion!
I don't think there is a real need to add syncing from the main repo to the wiki repo right now, given that there aren't a lot of requests for wiki changes. Furthermore, using the link you mentioned (the two links seem to be just forks of the same project) would require storing wiki pages within the main repo, and hence would also mean that wiki commits are reflected together with main repo commits (which, arguably, pollutes the commit history of the main repo).
Nevertheless, if you have a PR or suggestion to add to the wiki, feel free to raise an issue in this repo, and perhaps a link to your commit in your fork (of the wiki repo). I can manually cherry-pick your commit onto the wiki repo, or apply a patch file. Something like the answer described here.
Something like the answer described here.
🤣 one of the answers describes exactly what I'm suggesting lmao
- Put your documentation into the Git repository together with the code inside a documentation folder.
- Extend your Travis CI build with some magic that stages all changes from that documentation folder with transformations applied to the wiki Git. See last example link below.
I'll open an issue with a .patch file I guess. I had to google how to make a .patch file:
https://stackoverflow.com/questions/42800902/how-to-generate-patch-for-all-commits-in-a-branch
git diff master mybranch >mybranch.patch