Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Internal) Coverage changes based on how the commit is pushed #691

Open
mitchell-codecov opened this issue Apr 5, 2022 · 1 comment
Open

Comments

@mitchell-codecov
Copy link
Contributor

if (overrideCommit) {
execArgs.push('-C', `${overrideCommit}`);
} else if (
`${context.eventName}` == 'pull_request' ||
`${context.eventName}` == 'pull_request_target'
) {
execArgs.push('-C', `${context.payload.pull_request.head.sha}`);
}

Coverage changed in #690 for seemingly no reason. The reports say otherwise:

diff --git a/1.json b/2.json
index 9c0d047..ef411ff 100644
--- a/1.json
+++ b/2.json
@@ -2157,7 +2157,7 @@
             "81": 2,
             "82": 1,
             "83": 1,
-            "84": 0,
+            "84": 1,
             "85": 2,
             "86": 1,
             "87": 1,
@@ -2198,7 +2198,7 @@
             ],
             "1": [
                 2,
-                2
+                0
             ],
             "2": [
                 2
@@ -2256,11 +2256,11 @@
                 1
             ],
             "20": [
-                0
+                1
             ],
             "21": [
                 1,
-                1
+                0
             ],
             "22": [
                 1,
@jbergler
Copy link

jbergler commented Dec 1, 2023

I think we're running into this problem too.

When github actions triggers on pull_request rather than push github sets the ref to refs/remotes/pull/:id/merge which is the test merge of the PR.

In our case when code changed between the PR's merge base and the current head of the target branch, codecov doesn't seem to figure out that the coverage data being submitted wasn't actually for the HEAD of the PR branch, and creates really funky results.

I've tried overriding the commit when calling the action with github.sha which points to the code being checked out, but this doesn't seem to have any effect.

      - uses: codecov/codecov-action@v3
        with:
          token: "${{ secrets.CODECOV_TOKEN }}"
          override_commit: "${{ github.sha }}"

For us, in a busy repo this makes developers mistrust the codecov reports because they see things that are wrong and shouldn't be possible, eg:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants