From 85d048a6297bc44ba17f001ff73dac5374a72cd8 Mon Sep 17 00:00:00 2001 From: Arnaud Becheler <8360330+Becheler@users.noreply.github.com> Date: Mon, 8 Jun 2026 08:00:11 +0200 Subject: [PATCH] fix bot warning count to match head.sha against base repo open PR list --- .github/workflows/warning-count-comment.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/warning-count-comment.yml b/.github/workflows/warning-count-comment.yml index aacb0d415..5d0e5b65a 100644 --- a/.github/workflows/warning-count-comment.yml +++ b/.github/workflows/warning-count-comment.yml @@ -44,7 +44,14 @@ jobs: - name: Resolve PR number id: pr - run: echo "num=$(gh api "repos/$REPO/commits/$HEAD_SHA/pulls" --jq '.[0].number')" >> "$GITHUB_OUTPUT" + run: | + num=$(gh api "repos/$REPO/pulls?state=open&per_page=100" \ + --jq "map(select(.head.sha==\"$HEAD_SHA\"))[0].number") + if [ -z "$num" ]; then + echo "no open PR found with head $HEAD_SHA" >&2 + exit 1 + fi + echo "num=$num" >> "$GITHUB_OUTPUT" - name: Post or update sticky comment uses: marocchino/sticky-pull-request-comment@v2