Files
wp-plugin-starter-template-…/.github/workflows/sync-wiki.yml
marcusquinn c7b590870c
Some checks failed
Tests / PHP 7.0 (push) Has been cancelled
Tests / PHP 7.4 (push) Has been cancelled
Tests / PHP 8.0 (push) Has been cancelled
Tests / Code Style (push) Has been cancelled
Sync Wiki / Sync Wiki to GitHub (push) Has been cancelled
Release / Build and Release (push) Has been cancelled
Initial commit of WordPress Plugin Starter Template for AI Coding
2025-04-18 03:09:39 +01:00

52 lines
1.3 KiB
YAML

name: Sync Wiki
on:
push:
branches:
- main
paths:
- '.wiki/**'
jobs:
sync-wiki:
name: Sync Wiki to GitHub
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Configure Git
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
- name: Clone wiki repository
run: |
git clone https://github.com/${{ github.repository }}.wiki.git wiki
- name: Sync wiki content
run: |
# Remove all files from wiki repository except .git
find wiki -mindepth 1 -maxdepth 1 -not -name '.git' -exec rm -rf {} \;
# Copy .wiki content to wiki repository
cp -r .wiki/* wiki/
# Go to wiki repository
cd wiki
# Add all changes
git add .
# Check if there are changes to commit
if git diff --staged --quiet; then
echo "No changes to commit"
exit 0
fi
# Commit changes
git commit -m "Sync wiki from source repository"
# Push changes
git push https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.wiki.git