Gut icon indicating copy to clipboard operation
Gut copied to clipboard

[Suggestion] Use GitHub actions to publish wiki updates

Open brisberg opened this issue 3 years ago • 1 comments

I saw in your contributing guidelines that you suggest including wiki text changes in the PR description.

I wanted to show you a way to simplify this workflow by putting the contents of your Github wiki into your main repo and using GitHub Actions to sync changes from the repo to the wiki. This way contributors can edit the wiki contents directly in their PR without any manual copying on your part.

It will only update the wiki from the master branch.

My own documentation for this workflow describes how it work. It uses Github-wiki-Action to perform the sync, see their docs for more configuration.

Here is one of my repos which uses the workflow to sync the /wiki directory to the Wiki so you can see it in action.

I understand this is an unsolicited suggestion, so if you'd like to avoid this extra complexity I completely understand. Thanks for taking the time to read this.

Feel free to ask me any questions about this set up, or close this issue if you are not interested.


tl'dr

Add a new file .github/workflows/publish-wiki.yml from the repo root with the following contents exactly:

File Contents
name: Publish Wiki

on:
  push:
    branches:
      # Only on master branch
      - master
    paths:
      # And only trigger when wiki directory changes
      - 'wiki/**'

jobs:
  publish-wiki:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2

    - name: Push Wiki Changes
      uses: Andrew-Chen-Wang/github-wiki-action@v3
      env:
        WIKI_DIR: wiki/
        GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        GH_MAIL: ${{ github.event.pusher.email }}
        GH_NAME: ${{ github.event.pusher.name }}

Create a /wiki directory at the project root.

Copy the contents of the current wiki into this directory. You can do this manually or clone the wiki directly from https://github.com/bitwes/Gut.wiki.git and copy the folder.

Push those changes (with the .github/workflows directory) to master. Check the Actions tab to see the publish proceed.

brisberg avatar Jul 25 '22 03:07 brisberg

I really like the idea of wiki contributions being a lot easier to make. I'm going to look into this more. Thanks a lot for the tip.

bitwes avatar Aug 03 '22 00:08 bitwes

Wiki has been moved to gut.readthedocs.io and are now generated by them when changes are pushed.

bitwes avatar Jan 16 '24 18:01 bitwes