mirror of
https://github.com/acamarata/qibla.git
synced 2026-07-01 11:24:28 +00:00
42 lines
1.3 KiB
YAML
42 lines
1.3 KiB
YAML
name: Sync Wiki
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths: ['.github/wiki/**']
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
sync:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Checkout wiki
|
|
id: clone_wiki
|
|
run: |
|
|
if git clone "https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.wiki.git" .wiki-remote 2>&1; then
|
|
echo "wiki_exists=true" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "wiki_exists=false" >> "$GITHUB_OUTPUT"
|
|
echo "Wiki not yet initialized. Create the first page once via the GitHub web UI; subsequent runs will sync .github/wiki automatically."
|
|
fi
|
|
|
|
- name: Sync wiki pages
|
|
if: steps.clone_wiki.outputs.wiki_exists == 'true'
|
|
run: |
|
|
cp .github/wiki/*.md .wiki-remote/
|
|
cd .wiki-remote
|
|
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 wiki from repo"
|
|
git push origin HEAD:master
|
|
fi
|