-
-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (72 loc) · 2.42 KB
/
wiki-sync.yml
File metadata and controls
82 lines (72 loc) · 2.42 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Sync docs to wiki
on:
push:
branches:
- main
paths:
- 'docs/**'
- 'README.md'
- 'SUPPORT.md'
- 'CONTRIBUTING.md'
permissions:
contents: write
jobs:
sync-wiki:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Verify WIKI_TOKEN is configured
env:
WIKI_TOKEN: ${{ secrets.WIKI_TOKEN }}
run: |
if [ -z "$WIKI_TOKEN" ]; then
echo "Error: WIKI_TOKEN secret is not configured. Please add WIKI_TOKEN with a Personal Access Token that can push to World-Domination-Software/Projects.wiki." >&2
exit 1
fi
- name: Clone wiki repository
env:
WIKI_TOKEN: ${{ secrets.WIKI_TOKEN }}
run: |
git clone "https://x-access-token:${WIKI_TOKEN}@github.com/World-Domination-Software/Projects.wiki.git" wiki-repo
- name: Copy markdown docs into wiki root (flat)
run: |
shopt -s nullglob
# Copy top-level docs/*.md into wiki root (shared/public-facing pages)
for file in docs/*.md; do
base="$(basename "$file")"
echo "Copying $file -> wiki-repo/$base"
cp "$file" "wiki-repo/$base"
done
# Copy key root docs into wiki root
for file in README.md SUPPORT.md CONTRIBUTING.md; do
if [ -f "$file" ]; then
echo "Copying $file -> wiki-repo/$file"
cp "$file" "wiki-repo/$file"
fi
done
- name: Sync documentation images (banner and icons)
run: |
if [ -d docs/images ]; then
mkdir -p wiki-repo/images
echo "Syncing docs/images -> wiki-repo/images"
cp -R docs/images/* wiki-repo/images/
else
echo "No docs/images directory to sync."
fi
- name: Commit and push changes to wiki
working-directory: wiki-repo
run: |
if [ -n "$(git status --porcelain)" ]; then
git add .
git commit -m "Sync docs from main repo"
git push
else
echo "No documentation changes to sync."
fi