Skip to content

Commit b82c079

Browse files
committed
fix(ci): send X-GitHub-Event on the CDN deploy webhook
Dokploy reads the branch from the body only when the request carries an X-GitHub-Event header; without it the webhook answered 301 "Branch Not Match" and deployed nothing, so verify-cdn-release failed the 0.13.1 release with a stale CDN. 301 is not an error status, so --fail let the job pass green: check the status code instead.
1 parent ec98e74 commit b82c079

1 file changed

Lines changed: 16 additions & 8 deletions

File tree

.github/workflows/release.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -250,21 +250,29 @@ jobs:
250250
exit 0
251251
;;
252252
esac
253-
# The webhook matches the branch from the request body: a bare POST
254-
# answers 301 {"message":"Branch Not Match"} and deploys nothing.
253+
# The webhook reads the branch from the body, but only when the
254+
# request also carries `X-GitHub-Event`: Dokploy's extractBranchName
255+
# returns null without that header, so the request answers
256+
# 301 {"message":"Branch Not Match"} and deploys nothing.
257+
#
258+
# 301 is not an error status, so `--fail` does not see it and curl
259+
# exits 0. Capture the status code and treat anything but 2xx as a
260+
# failed deploy.
255261
#
256262
# A transient failure must never fail the workflow. npm has already
257263
# published by now and that is irreversible, so dying here buys
258264
# nothing — an earlier version of this job was deleted because a
259265
# curl exit-28 timeout failed the 0.5.0 release. verify-cdn-release
260-
# polls the manifest and is the gate that fails loudly. `--fail` is
261-
# what makes an HTTP error status reach the retries and the warning
262-
# instead of exiting 0 and reading as a successful deploy.
263-
curl -sS --fail -X POST "$WEBHOOK" \
266+
# polls the manifest and is the gate that fails loudly.
267+
status=$(curl -sS -o /dev/stderr -w '%{http_code}' -X POST "$WEBHOOK" \
264268
-H 'Content-Type: application/json' \
269+
-H 'X-GitHub-Event: push' \
265270
-d '{"ref":"refs/heads/main"}' \
266-
--retry 3 --retry-all-errors --retry-delay 10 --max-time 60 \
267-
|| echo "::warning::CDN redeploy webhook failed — verify-cdn-release will catch a stale CDN."
271+
--retry 3 --retry-all-errors --retry-delay 10 --max-time 60) || status=000
272+
case "$status" in
273+
2*) echo "CDN redeploy triggered (HTTP $status)." ;;
274+
*) echo "::warning::CDN redeploy webhook returned HTTP $status — verify-cdn-release will catch a stale CDN." ;;
275+
esac
268276
269277
# Verifies that the published release is internally consistent and that the
270278
# CDN caught up with npm. It polls, so it must run after redeploy-cdn.

0 commit comments

Comments
 (0)