Skip to content

Commit 898528b

Browse files
committed
ci: notify MaaNTE-Web when docs update
1 parent cabe440 commit 898528b

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Notify MaaNTE-Web Docs Update
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
paths:
8+
- "docs/zh_cn/**"
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
dispatch:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Dispatch update event to MaaNTE-Web
18+
env:
19+
GH_TOKEN: ${{ secrets.MAANTE_BOT_TOKEN }}
20+
TARGET_REPO: "Maa-NTE/MaaNTE-Web"
21+
EVENT_TYPE: "md_changes"
22+
SOURCE_REPO: ${{ github.repository }}
23+
SOURCE_BRANCH: ${{ github.ref_name }}
24+
SOURCE_SHA: ${{ github.sha }}
25+
run: |
26+
if [ -z "$GH_TOKEN" ]; then
27+
echo "MAANTE_BOT_TOKEN is not set"
28+
exit 1
29+
fi
30+
31+
curl --fail --silent --show-error \
32+
-X POST \
33+
-H "Accept: application/vnd.github+json" \
34+
-H "Authorization: Bearer ${GH_TOKEN}" \
35+
"https://api.github.com/repos/${TARGET_REPO}/dispatches" \
36+
-d "{\"event_type\":\"${EVENT_TYPE}\",\"client_payload\":{\"source_repo\":\"${SOURCE_REPO}\",\"source_branch\":\"${SOURCE_BRANCH}\",\"source_sha\":\"${SOURCE_SHA}\"}}"
37+
38+
echo "Dispatched ${EVENT_TYPE} to ${TARGET_REPO}"

0 commit comments

Comments
 (0)