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
17 changes: 17 additions & 0 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
HEAD_REF: ${{ github.event.pull_request.head.ref }}
PR_NUMBER: ${{ github.event.pull_request.number }}
FORK_REPO: ${{ github.event.pull_request.head.repo.full_name }}
UPSTREAM_REPO: ${{ github.repository }}
run: |
Expand All @@ -75,6 +77,21 @@ jobs:
break
fi

# Fallback for reopened PRs: no new run may exist for HEAD_SHA,
# so locate the latest pull_request run for this PR number/branch.
RUN_ID=$(gh api \
"repos/${FORK_REPO}/actions/runs?event=pull_request&branch=${HEAD_REF}&per_page=50" \
--jq '.workflow_runs[]
| select(.name == "SapMachine GHA Sanity Checks")
| select(any(.pull_requests[]?; .number == ('"${PR_NUMBER}"' | tonumber)))
| .id' \
2>/dev/null | head -1)

if [[ -n "$RUN_ID" && "$RUN_ID" != "null" ]]; then
echo "Found fork workflow run via PR fallback: ${RUN_ID}"
break
fi

sleep 60
done

Expand Down
Loading