Skip to content

Commit 501e9ed

Browse files
committed
ci: add wiki sync workflow
1 parent d3aad93 commit 501e9ed

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

.github/workflows/sync-wiki.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: sync-wiki
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [main]
7+
paths:
8+
- 'wiki/**'
9+
- 'docs/wiki/**'
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
sync:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Prepare wiki content
21+
run: |
22+
mkdir -p /tmp/ai-os-wiki
23+
cp -R wiki/. /tmp/ai-os-wiki/
24+
find /tmp/ai-os-wiki -type f -name '*.md' -print
25+
26+
- name: Push wiki pages
27+
env:
28+
TOKEN: ${{ secrets.WIKI_TOKEN || secrets.GITHUB_TOKEN }}
29+
run: |
30+
set -euo pipefail
31+
git config --global user.name "github-actions[bot]"
32+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
33+
git clone "https://x-access-token:${TOKEN}@github.com/${{ github.repository }}.wiki.git" /tmp/wiki-repo
34+
rsync -av --delete /tmp/ai-os-wiki/ /tmp/wiki-repo/
35+
cd /tmp/wiki-repo
36+
git add .
37+
if git diff --cached --quiet; then
38+
echo "Wiki already up to date"
39+
else
40+
git commit -m "docs: sync wiki pages"
41+
git push
42+
fi

0 commit comments

Comments
 (0)