From 953a7b6b1434b254b5dee3cdde823da805c8d3cf Mon Sep 17 00:00:00 2001 From: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com> Date: Wed, 11 Mar 2026 23:19:30 -0300 Subject: [PATCH] fix(ci): Fix fetching wrong PR number --- .github/workflows/tests_hw_wokwi.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests_hw_wokwi.yml b/.github/workflows/tests_hw_wokwi.yml index 1eabf75bb..892a70029 100644 --- a/.github/workflows/tests_hw_wokwi.yml +++ b/.github/workflows/tests_hw_wokwi.yml @@ -112,9 +112,11 @@ jobs: # Fallback: commits API only works for same-repo PRs; use search API for fork PRs if [ -z "$pr_num" ]; then - echo "Commits API returned empty, trying search API for fork PRs..." - pr_num=$(gh api "search/issues" -f q="repo:$GH_REPO type:pr $WR_HEAD_SHA" \ - --jq '.items[0].number // empty' 2>/dev/null | tr -cd "[:digit:]") || true + echo "Commits API returned empty, scanning open PRs by head SHA for fork PRs..." + pr_num=$(gh api "repos/$GH_REPO/pulls?state=open&per_page=100" \ + --paginate \ + --jq ".[] | select(.head.sha == \"$WR_HEAD_SHA\") | .number" \ + 2>/dev/null | head -1 | tr -cd "[:digit:]") || true fi if [ -n "$pr_num" ]; then