Skip to content

Commit 5c4aedf

Browse files
authored
Add GitHub Actions workflow for webhook notifications (#24)
1 parent 7f81a90 commit 5c4aedf

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

.github/workflows/eo-dev-build.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Notify Tencent Pages Webhook on server changes
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
paths:
8+
- "src/server/**"
9+
10+
jobs:
11+
notify:
12+
name: Send webhook POST
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Send webhook POST to EO Pages
16+
env:
17+
WEBHOOK_URL: ${{ secrets.EO_PAGES_WEBHOOK }}
18+
run: |
19+
set -e
20+
echo "::add-mask::${WEBHOOK_URL}"
21+
22+
payload='{"ref":"'"$GITHUB_REF"'","repository":"'"$GITHUB_REPOSITORY"'","pusher":"'"$GITHUB_ACTOR"'"}'
23+
24+
status=$(curl -s -o /dev/null -w "%{http_code}" -X POST -H "Content-Type: application/json" -d "$payload" "$WEBHOOK_URL")
25+
26+
if [ "$status" -ge 200 ] && [ "$status" -lt 300 ]; then
27+
echo "Webhook POST succeeded (status $status)"
28+
else
29+
echo "Webhook POST failed with status $status"
30+
exit 1
31+
fi

0 commit comments

Comments
 (0)