Skip to content

Allow collection copying in flatten (#245) #4

Allow collection copying in flatten (#245)

Allow collection copying in flatten (#245) #4

name: Sync Docs to Wiki
on:
push:
branches:
- master
paths:
- 'docs/**'
workflow_dispatch: # Allow manual trigger
jobs:
sync-wiki:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Sync docs to wiki
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Configure git
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
# Clone the wiki repository
git clone "https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.wiki.git" wiki
# Remove existing wiki content (except .git)
find wiki -mindepth 1 -maxdepth 1 ! -name '.git' -exec rm -rf {} +
# Copy docs folder contents to wiki
cp -r docs/* wiki/
# Rename README.md to Home.md if it exists (wiki home page)
if [ -f wiki/README.md ]; then
mv wiki/README.md wiki/Home.md
fi
# Commit and push changes
cd wiki
git add -A
if git diff --staged --quiet; then
echo "No changes to sync"
else
git commit -m "Sync docs from main repository"
git push
fi