From 2bb543d29b6324d9a69fc4216103b2a6a3b106b2 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Martineau Date: Mon, 21 Sep 2026 23:10:27 -0400 Subject: [PATCH] The trailer check reads "Fixes #12" and trusts only a 404 It only recognised trailers written with a colon, so "Fixes #12", which GitHub closes on just the same, went unchecked, as did fix, fixed, close, closed, resolve and resolved. The colon is now optional and every closing keyword counts. It also treated any failed lookup as a missing issue, so a rate limit or an outage would have left a public comment on a commit saying a real issue did not exist. Now only a 404 does that; anything else is a warning in the log. Co-Authored-By: Claude Opus 5 (1M context) --- .github/workflows/issue-trailers.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/issue-trailers.yml b/.github/workflows/issue-trailers.yml index 03bfde7..2766360 100644 --- a/.github/workflows/issue-trailers.yml +++ b/.github/workflows/issue-trailers.yml @@ -47,16 +47,18 @@ jobs: # Trailers only: a line that starts with the keyword. A bare "#12" # in prose is a reference someone wrote on purpose, not a claim - # that this commit closes anything. + # that this commit closes anything. The colon is optional, because + # GitHub closes on "Fixes #12" just as it does on "Fixes: #12", and + # the keywords are every form GitHub accepts, plus refs and see. refs=$(printf '%s\n' "$msg" \ - | grep -oiE '^(fixes|closes|resolves|refs|see):[[:space:]]*([A-Za-z0-9._-]+/[A-Za-z0-9._-]+)?#[0-9]+' \ + | grep -oiE '^(fix|fixes|fixed|close|closes|closed|resolve|resolves|resolved|refs|see)(:[[:space:]]*|[[:space:]]+)([A-Za-z0-9._-]+/[A-Za-z0-9._-]+)?#[0-9]+' \ || true) [ -z "$refs" ] && continue while IFS= read -r ref; do [ -z "$ref" ] && continue - target=$(printf '%s' "$ref" | sed -E 's/^[A-Za-z]+:[[:space:]]*//') + target=$(printf '%s' "$ref" | sed -E 's/^[A-Za-z]+:?[[:space:]]*//') num="${target##*#}" if [ "$target" != "#${num}" ]; then @@ -65,8 +67,13 @@ jobs: continue fi - if state=$(gh api "repos/$REPO/issues/$num" --jq .state 2>/dev/null); then + if state=$(gh api "repos/$REPO/issues/$num" --jq .state 2>/tmp/gh.err); then echo " $short -> #$num ($state)" + elif ! grep -q 'HTTP 404' /tmp/gh.err; then + # Only a 404 means the issue is missing. Anything else (a rate + # limit, an outage) says nothing about the trailer, and a public + # comment calling a real issue missing would be worse than silence. + echo "::warning::could not check #$num for commit $short: $(head -c 200 /tmp/gh.err)" else echo "::error::commit $short names #$num, which does not exist in $REPO" problems=$((problems + 1))