fix: handle Gitea 1.27's workflow_call event name in the trigger gate

Gitea 1.27 (breaking change go-gitea#37478) runs a called (reusable)
workflow with github.event_name = 'workflow_call' instead of propagating
the caller's event. Every consumer stub forwards EVENT_NAME from
github.event_name, so since the server upgrade every review arrived as an
unhandled event and self-skipped in one second while reporting success —
mort PRs #1445-#1447 all went unreviewed.

Reclassify workflow_call from the forwarded payload: a non-empty
COMMENT_BODY can only come from issue_comment (trigger-phrase + actor
gates still apply); otherwise a PR number means a pull_request-shaped
trigger. Neither → the existing unhandled-event skip. Pre-1.27 servers
are unaffected.

Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
2026-07-15 23:00:43 -04:00
co-authored by Claude Fable 5
parent 5007597cf9
commit ed9e946cd1
+20
View File
@@ -110,6 +110,26 @@ actor_allowed() {
}
# --- 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
workflow_dispatch)
log "manual dispatch for PR #${PR}" ;;