-
-
Notifications
You must be signed in to change notification settings - Fork 75
56 lines (45 loc) · 1.36 KB
/
sync-wiki.yml
File metadata and controls
56 lines (45 loc) · 1.36 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
name: Sync Wiki
on:
push:
branches:
- main
paths:
- '.wiki/**'
# Allow manual triggering
workflow_dispatch:
jobs:
sync-wiki:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
fetch-depth: 0
- name: Configure Git
run: |
git config --global user.name "GitHub Action"
git config --global user.email "action@github.com"
- name: Clone Wiki
run: |
git clone "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.wiki.git" wiki
- name: Sync Wiki Content
run: |
# Remove all files from wiki repository (except .git directory)
find wiki -mindepth 1 -maxdepth 1 -not -name ".git" -exec rm -rf {} \;
# Copy all files from .wiki directory to wiki repository
cp -r .wiki/* wiki/
# Go to wiki repository
cd wiki
# Add all files
git add .
# Check if there are changes
if git diff --staged --quiet; then
echo "No changes to commit"
exit 0
fi
# Commit changes
git commit -m "Sync wiki from .wiki directory"
# Push changes
git push