-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (58 loc) · 1.93 KB
/
Copy pathgenerate-docs.yml
File metadata and controls
65 lines (58 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Generate API Docs
on:
push:
branches: [main]
paths:
- 'libs/**/*.m'
workflow_dispatch:
permissions:
contents: write
jobs:
generate:
name: Generate API Documentation
runs-on: ubuntu-latest
steps:
- name: Checkout main repo
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Generate API docs
run: python3 scripts/generate_api_docs.py
- name: Commit updated wiki
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add wiki/
if git diff --cached --quiet; then
echo "No documentation changes"
else
git commit -m "docs: auto-update API reference from source code"
git push
echo "Wiki API docs updated in main repo"
fi
- name: Sync to wiki repo
if: success()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Only sync if the commit step actually pushed changes
if git log -1 --format='%s' | grep -q "auto-update API reference"; then
git clone "https://x-access-token:${GITHUB_TOKEN}@github.com/HanSur94/FastSense.wiki.git" wiki-remote
rm -f wiki-remote/*.md
cp 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 "Wiki repo already up to date"
else
git commit -m "docs: sync wiki from main repo"
git push
echo "Wiki repo synced"
fi
else
echo "No wiki changes were committed, skipping sync"
fi