Rename ultimate (#96) #4
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 Wiki | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - '.wiki/**' | |
| # Allow manual triggering | |
| workflow_dispatch: | |
| jobs: | |
| sync-wiki: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Configure Git | |
| run: | | |
| git config --global user.name "GitHub Action" | |
| git config --global user.email "action@github.com" | |
| - name: Clone Wiki | |
| run: | | |
| git clone "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.wiki.git" wiki | |
| - name: Sync Wiki Content | |
| run: | | |
| # Remove all files from wiki repository (except .git directory) | |
| find wiki -mindepth 1 -maxdepth 1 -not -name ".git" -exec rm -rf {} \; | |
| # Copy all files from .wiki directory to wiki repository | |
| cp -r .wiki/* wiki/ | |
| # Go to wiki repository | |
| cd wiki | |
| # Add all files | |
| git add . | |
| # Check if there are changes | |
| if git diff --staged --quiet; then | |
| echo "No changes to commit" | |
| exit 0 | |
| fi | |
| # Commit changes | |
| git commit -m "Sync wiki from .wiki directory" | |
| # Push changes | |
| git push |