Skip coverage upload for merge queue runs
Merge queue commits are ephemeral — coverage was already uploaded during the PR, and the push to the default branch will upload results for the final landed commit. Log a warning and exit successfully instead of wasting an API call. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -104,3 +104,4 @@ The repository must have the following feature flags enabled:
|
||||
## Caveats
|
||||
|
||||
- **Fork PRs are not supported.** Pull requests from forks don't have write access to the base repository, so the action cannot upload coverage. When a fork PR is detected, the action exits gracefully with a notice — it won't fail your CI.
|
||||
- **Merge queue runs are skipped.** Coverage should be uploaded for PRs and the default branch, making merge queue uploads unnecessary. The action logs a warning and exits successfully.
|
||||
|
||||
@@ -34,6 +34,14 @@ runs:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Skip coverage upload for merge queue runs — coverage should be
|
||||
# uploaded for PRs and the default branch, making merge queue
|
||||
# uploads unnecessary.
|
||||
if [ "${{ github.event_name }}" = "merge_group" ]; then
|
||||
echo "::warning::Skipping coverage upload for merge queue. Configure your workflow to upload coverage for PRs and the default branch instead. To avoid spinning up a runner, add \"if: github.event_name != 'merge_group'\" to the upload job."
|
||||
exit 0
|
||||
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 }}" != "" ] && \
|
||||
|
||||
Reference in New Issue
Block a user