Sync Docs to Wiki #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Sync Docs to Wiki | |
description: > | |
Syncs the contents of the docs/ folder to the GitHub Wiki repository for this project. | |
on: | |
workflow_dispatch: | |
release: | |
types: [published] | |
jobs: | |
sync-wiki: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Set up Git | |
run: | | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
- name: Clean up existing wiki directory | |
run: | | |
if [ -d "wiki" ]; then | |
rm -rf wiki | |
fi | |
- name: Clone the wiki repository | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git clone https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.wiki.git wiki | |
- name: Sync docs to wiki | |
run: | | |
rsync -av --delete docs/ wiki/ | |
- name: Commit and push changes to wiki | |
run: | | |
cd wiki | |
git add . | |
git commit -m "Sync docs to wiki [ci skip]" || echo "No changes to commit" | |
git push | |
- name: Clean up wiki directory after push | |
run: | | |
rm -rf wiki |