diff --git a/.github/workflows/wiki.yml b/.github/workflows/wiki.yml new file mode 100644 index 0000000..1918622 --- /dev/null +++ b/.github/workflows/wiki.yml @@ -0,0 +1,39 @@ +name: Sync docs to Wiki + +on: + push: + branches: [main] + paths: + - 'docs/**' + workflow_dispatch: + +permissions: + contents: write + +jobs: + wiki: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Checkout wiki + uses: actions/checkout@v4 + with: + repository: ${{ github.repository }}.wiki + path: wiki + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Sync docs to wiki + run: | + rsync -av --delete --exclude='.git' docs/ wiki/ + cd wiki + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add -A + if git diff --cached --quiet; then + echo "No wiki changes to commit." + else + git commit -m "Sync docs from ${GITHUB_SHA::8}" + git push + fi