Skip coverage upload for fork PRs
Fork PR tokens don't have write access to the base repo, so the upload would fail with 403. Detect this early and exit with a notice instead of a red CI step. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -34,6 +34,14 @@ runs:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Skip coverage upload for fork PRs — the token won't have write
|
||||
# permissions to the base repository.
|
||||
if [ "${{ github.event.pull_request.head.repo.full_name }}" != "" ] && \
|
||||
[ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]; then
|
||||
echo "::notice::Skipping coverage upload for fork PR (from ${{ github.event.pull_request.head.repo.full_name }})"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Resolve the commit SHA and ref. On pull_request events, github.sha
|
||||
# and github.ref point to the merge commit — use the PR head instead.
|
||||
if [ "${{ github.event_name }}" = "pull_request" ] || [ "${{ github.event_name }}" = "pull_request_target" ]; then
|
||||
|
||||
Reference in New Issue
Block a user