From 1b2407f6e2311ab4bae3372e24c83fc8453b04c4 Mon Sep 17 00:00:00 2001 From: sudolulo Date: Mon, 13 Jul 2026 19:08:27 +0000 Subject: [PATCH] compat: dedup the bug report deterministically (lowest issue number wins) Two issues with the same title already existed -- the old title embedded the list of broken refs, so the issue's identity changed whenever that set changed. With an order-dependent pick the bot would alternate between them, reopening one and commenting on the other. Lowest number is stable regardless of how the API sorts. --- .github/workflows/compat.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/compat.yml b/.github/workflows/compat.yml index 1c93a94..fd79d1c 100644 --- a/.github/workflows/compat.yml +++ b/.github/workflows/compat.yml @@ -175,9 +175,10 @@ jobs: # One issue per set of broken refs, reopened/updated rather than duplicated # daily -- a bot that files the same issue every morning gets muted, and # then it is not a warning system any more. + # Lowest-numbered match, for the same reason as the Gitea step below. existing="$(gh issue list --state all --search "$TITLE" \ --json number,title \ - --jq '.[] | select(.title == env.TITLE) | .number' | head -1)" + --jq '[.[] | select(.title == env.TITLE) | .number] | min // empty')" if [ -n "$existing" ]; then gh issue comment "$existing" --body-file /tmp/issue.md @@ -214,8 +215,16 @@ jobs: # Same title => same issue. Comment on it rather than filing a new one every # morning: a bot that duplicates itself daily gets muted, and then it is not # a warning system any more. + # LOWEST-numbered match, not "whichever the API returns first". Two issues + # with the same title already existed once (the old title embedded the ref + # list, so the identity changed when that set changed), and an + # order-dependent pick would have alternated between them, reopening one and + # commenting on the other. Lowest number is stable no matter what the API + # sorts by. issues = call(f"{api}/issues?state=all&type=issues", "GET") - match = next((i for i in issues if i["title"] == title), None) + matches = sorted((i for i in issues if i["title"] == title), + key=lambda i: i["number"]) + match = matches[0] if matches else None if match: n = match["number"]