Skip to content

Commit e6fa040

Browse files
authored
Merge pull request #503 from Becheler/fix/warning-bot-fork-pr-number
fix bot warning count to match head.sha against base repo open PR list
2 parents 35c7a09 + 85d048a commit e6fa040

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

.github/workflows/warning-count-comment.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,14 @@ jobs:
4444
4545
- name: Resolve PR number
4646
id: pr
47-
run: echo "num=$(gh api "repos/$REPO/commits/$HEAD_SHA/pulls" --jq '.[0].number')" >> "$GITHUB_OUTPUT"
47+
run: |
48+
num=$(gh api "repos/$REPO/pulls?state=open&per_page=100" \
49+
--jq "map(select(.head.sha==\"$HEAD_SHA\"))[0].number")
50+
if [ -z "$num" ]; then
51+
echo "no open PR found with head $HEAD_SHA" >&2
52+
exit 1
53+
fi
54+
echo "num=$num" >> "$GITHUB_OUTPUT"
4855
4956
- name: Post or update sticky comment
5057
uses: marocchino/sticky-pull-request-comment@v2

0 commit comments

Comments
 (0)