Skip to content

Commit 2686c80

Browse files
authored
Merge pull request #6 from Foscat/copilot/fix-wiki-tab-issue
chore: sync wiki/ folder to GitHub Wiki via Actions workflow
2 parents 6b4da4a + d556a44 commit 2686c80

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

.github/workflows/wiki-sync.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Sync wiki
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- wiki/**
9+
workflow_dispatch:
10+
11+
jobs:
12+
sync:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
21+
- name: Checkout wiki repository
22+
uses: actions/checkout@v4
23+
with:
24+
repository: ${{ github.repository }}.wiki
25+
token: ${{ github.token }}
26+
path: wiki-repo
27+
28+
- name: Push wiki folder to GitHub Wiki
29+
run: |
30+
git -C wiki-repo config user.name "github-actions[bot]"
31+
git -C wiki-repo config user.email "github-actions[bot]@users.noreply.github.com"
32+
33+
# Copy wiki files while preserving the cloned repository metadata
34+
rsync -av --delete \
35+
--exclude=".git/" \
36+
--exclude="WIKI_SETUP.md" \
37+
wiki/ wiki-repo/
38+
39+
cd wiki-repo
40+
41+
git add -A
42+
43+
if git diff --cached --quiet; then
44+
echo "No wiki changes to commit."
45+
exit 0
46+
fi
47+
48+
git commit -m "Sync wiki from main repo @ ${{ github.sha }}"
49+
git push

0 commit comments

Comments
 (0)