Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions .github/workflows/issue-triage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,22 @@ jobs:
# find our previous triage comment (if any). its presence means this issue
# was already triaged, so a re-run refreshes the comment but leaves labels
# and fields alone - never clobbering a maintainer's later edits.
CID=$(gh api "repos/$REPO/issues/$NUM/comments" --paginate \
--jq "[.[] | select(.body | contains(\"$MARKER\")) | .id] | last // empty" 2>/dev/null || true)
FIRST_TRIAGE=true; [ -n "$CID" ] && FIRST_TRIAGE=false
#
# distinguish "lookup succeeded, no marker" (genuinely first triage) from
# "lookup failed" (transient api/auth/network error). on failure we must NOT
# default to first-triage, or a flaky api call could re-apply labels over a
# maintainer's edits - so fail safe: assume re-triage (no label/field changes).
# stderr is left visible on purpose: the if/else handles failure, so any
# gh error (auth/scope/rate/network) should show up in the run log.
if CID_RAW=$(gh api "repos/$REPO/issues/$NUM/comments" --paginate \
--jq "[.[] | select(.body | contains(\"$MARKER\")) | .id] | last // empty"); then
# --paginate emits one (possibly empty) line per page; keep the matched id.
Comment thread
duzos marked this conversation as resolved.
CID=$(printf '%s\n' "$CID_RAW" | grep -E '^[0-9]+$' | tail -1 || true)
FIRST_TRIAGE=true; [ -n "$CID" ] && FIRST_TRIAGE=false
else
echo "comment lookup failed - treating as re-triage so labels/fields aren't clobbered"
CID=""; FIRST_TRIAGE=false
fi

# prefer the whole response if it already parses as json (expected case:
# the model is asked for one line of minified json). otherwise strip any
Expand Down
Loading