CI: fix Scrutinizer coverage upload tagged to wrong commit revision#116
Closed
aik099 wants to merge 1 commit into
Closed
CI: fix Scrutinizer coverage upload tagged to wrong commit revision#116aik099 wants to merge 1 commit into
aik099 wants to merge 1 commit into
Conversation
On pull_request-triggered runs, actions/checkout checks out the ephemeral merge commit, not the PR branch's head commit. ocular.phar defaults --revision to `git rev-parse HEAD`, so coverage was being uploaded tagged to that merge commit's SHA. Scrutinizer's own inspection tracks the real PR head commit, never finds matching coverage for it, and the "Scrutinizer" check errors out waiting for data that was uploaded under the wrong revision. Pass --revision explicitly, preferring the PR head SHA over $GITHUB_SHA.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #116 +/- ##
=========================================
Coverage 97.73% 97.73%
Complexity 498 498
=========================================
Files 29 29
Lines 1460 1460
=========================================
Hits 1427 1427
Misses 33 33 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Owner
Author
|
Closing — confirmed via Scrutinizer's own API ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
After #115 fixed the dead
ocular.phardownload URL, coverage uploads to Scrutinizer succeed (e.g.Uploading code coverage for repository "g/aik099/CodingStandard" and revision "997bb8dd..."... Donein #114's logs), but the "Scrutinizer" GitHub status check still errors out on PRs.Root cause:
ocular.phar code-coverage:uploaddefaults--revisiontogit rev-parse HEAD. On apull_request-triggered workflow run,actions/checkoutchecks out GitHub's ephemeral merge commit (combining base + head), not the PR branch's actual head commit — so the uploaded coverage gets tagged to that merge commit's SHA (997bb8dd...in the example above), which is a different SHA on every run and not the commit Scrutinizer's own inspection is tracking (the actual PR head, e.g.2569dd9c...). Scrutinizer's inspection never finds coverage for the commit it's watching and the check errors out.Fix
Pass
--revisionexplicitly to bothocular.phar/ocularinvocations, preferring the real PR head SHA when available:github.event.pull_request.head.shais only set onpull_requestevents (where the mismatch happens); it falls back togithub.shafor plainpushruns, wheregit rev-parse HEADalready matched anyway.