Merge pull request 'fix: handle Gitea 1.27's workflow_call event name in the trigger gate' (#21) from fix/gitea-127-workflow-call into main
Build & push image / build-and-push (push) Successful in 2m30s

This commit was merged in pull request #21.
This commit is contained in:
2026-07-16 03:00:40 +00:00
+20
View File
@@ -110,6 +110,26 @@ actor_allowed() {
} }
# --- trigger gating -------------------------------------------------------- # --- trigger gating --------------------------------------------------------
# Gitea >= 1.27 (breaking change go-gitea#37478, "improve support for reusable
# workflows") runs a CALLED workflow with github.event_name = 'workflow_call'
# instead of propagating the caller's event, so every consumer stub's trigger
# arrived here as an unhandled event and the review silently self-skipped
# (observed 2026-07-14: mort PRs #1445-#1447 got 1-second "success" runs).
# Reclassify from the forwarded event payload: a comment body can only come
# from issue_comment (its trigger-phrase + actor gates still apply below);
# otherwise a PR number means a pull_request-shaped trigger (this also covers
# dispatch-through-reusable, whose pr_number input populates PR — the draft
# check degrades safely since IS_DRAFT defaults false). Neither → fall through
# to the unhandled-event skip. Pre-1.27 servers still send the caller's event
# name and never enter this branch.
if [ "${EVENT_NAME:-}" = "workflow_call" ]; then
if [ -n "${COMMENT_BODY:-}" ]; then
EVENT_NAME="issue_comment"
elif [ -n "${PR:-}" ]; then
EVENT_NAME="pull_request"
fi
log "caller event arrived as 'workflow_call'; reclassified to '${EVENT_NAME}'"
fi
case "$EVENT_NAME" in case "$EVENT_NAME" in
workflow_dispatch) workflow_dispatch)
log "manual dispatch for PR #${PR}" ;; log "manual dispatch for PR #${PR}" ;;