-
-
Notifications
You must be signed in to change notification settings - Fork 39
66 lines (54 loc) 路 1.91 KB
/
Copy pathwiki-sync.yml
File metadata and controls
66 lines (54 loc) 路 1.91 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
name: Wiki sync
on:
push:
paths:
- docs/wiki/**
- .github/workflows/wiki-sync.yml
branches:
- master
env:
CLICOLOR: 1 # Enables pretty color output for typos
jobs:
run:
name: Run
runs-on: ubuntu-slim
permissions:
contents: write
steps:
- name: 馃摜 Checkout source
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
sparse-checkout: docs
path: src
- name: 馃摜 Checkout ancillary wiki repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
repository: ${{ github.repository }}.wiki
path: wiki
- name: 馃攧 Sync wiki files
run: rsync -av --delete --exclude=.git src/docs/wiki/ wiki
- name: "馃攳 Lint: check typos"
uses: crate-ci/typos@5374cbf686e897b15713110e233094e2874de7ef # v1
with:
files: wiki
- name: 馃摑 Extract source commit metadata
working-directory: src
shell: bash
run: |
echo "WIKI_SYNC_REF_AUTHOR=$(git show -s --format='%an <%ae>' HEAD)" >> "$GITHUB_ENV"
echo "WIKI_SYNC_REF_AUTHOR_DATE=$(git show -s --format='%ad' HEAD)" >> "$GITHUB_ENV"
git show -s --format='${{ github.repository }}@%h: %s' HEAD > /tmp/wiki_sync_commit_message
- name: 馃捑 Commit wiki file changes to wiki repository
working-directory: wiki
run: |
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git config --global user.name 'github-actions[bot]'
git add .
if git diff --cached --quiet; then
echo 'No changes staged, skipping commit'
else
git commit \
--author="$WIKI_SYNC_REF_AUTHOR" --date="$WIKI_SYNC_REF_AUTHOR_DATE" \
--message="$(cat /tmp/wiki_sync_commit_message)"
git push
fi