-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (60 loc) · 1.89 KB
/
Copy pathsync-wiki.yml
File metadata and controls
72 lines (60 loc) · 1.89 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
name: Sync Wiki
on:
push:
branches:
- main
paths:
- 'wiki/**'
workflow_dispatch:
jobs:
sync-wiki:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Checkout wiki repository
uses: actions/checkout@v6
with:
repository: ${{ github.repository }}.wiki
path: wiki-repo
- name: Sync wiki files
run: |
echo "Syncing wiki files from main repository to wiki..."
# Copy all markdown files except README.md
for file in wiki/*.md; do
filename=$(basename "$file")
if [ "$filename" != "README.md" ]; then
cp "$file" wiki-repo/
echo " Copied: $filename"
fi
done
echo ""
echo "Wiki contents:"
ls -lh wiki-repo/*.md
- name: Commit and push changes
working-directory: wiki-repo
run: |
# Configure git
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# Add all changes
git add .
# Check if there are changes
if git diff --quiet HEAD; then
echo "No changes to commit"
else
echo "Changes detected, committing..."
# Create commit with proper multi-line message
git commit \
-m "docs: auto-sync wiki from main repository" \
-m "" \
-m "Updated: $(date -u '+%Y-%m-%d %H:%M:%S UTC')" \
-m "Source commit: ${{ github.sha }}" \
-m "Triggered by: ${{ github.event_name }}"
# Push to wiki repository
echo "Pushing to wiki repository..."
git push
echo "✓ Wiki synchronized successfully!"
fi