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

Correct SHA may not being chosen when used in a pre-merge commit #372

Closed
drazisil-codecov opened this issue Feb 2, 2024 · 1 comment · Fixed by #397
Closed

Correct SHA may not being chosen when used in a pre-merge commit #372

drazisil-codecov opened this issue Feb 2, 2024 · 1 comment · Fixed by #397
Assignees
Labels
bug Something isn't working

Comments

@drazisil-codecov
Copy link
Contributor

Issue: My notifications are not working when using the CLI.

In the case that the incorrect SHA is picked, Codecov will show the commit message as merge <SHA>

Workaround: You can manually pass the correct SHA to the CLI with the --sha flag.

If you are using the CircleCI orb, or the GitHub action, please see that wrappers's docs for the method to manually pass the SHA.

We are aware of this issue.

@drazisil-codecov drazisil-codecov added the bug Something isn't working label Feb 2, 2024
@drazisil-codecov
Copy link
Contributor Author

The Uploader uses the following logic to detect the correct SHA in a pre-merge commit:

https://github.com/codecov/uploader/blob/1e505ba8a27a1e3311a7a8db7f314e3705a2ee08/src/ci_providers/provider_githubactions.ts#L97-L122

@drazisil-codecov drazisil-codecov pinned this issue Feb 2, 2024
@thomasrockhu-codecov thomasrockhu-codecov self-assigned this Feb 3, 2024
giovanni-guidini added a commit that referenced this issue Mar 5, 2024
Apparently a common thing for CIs to do is create a merge-commit for changes
in a branch before running tests and stuff.
This means that - especially for not-directly-supported CIs - we would maybe
return a SHA for a commit that didn't exist in the branch.

These changes fix that by checking to see if the current commit is a merge commit.
If it is we return the second parent, the most recent commit before the current one.

Q: What if the current latest commit in the branch is a merge commit?
Well in this case the parent, which is also part of the branch, will have the coverage.

Users can still provide a commit sha value to override this behavior.

closes #372
giovanni-guidini added a commit that referenced this issue Mar 6, 2024
Apparently a common thing for CIs to do is create a merge-commit for changes
in a branch before running tests and stuff.
This means that - especially for not-directly-supported CIs - we would maybe
return a SHA for a commit that didn't exist in the branch.

These changes fix that by checking to see if the current commit is a merge commit.
If it is we return the second parent, the most recent commit before the current one.

Q: What if the current latest commit in the branch is a merge commit?
Well in this case the parent, which is also part of the branch, will have the coverage.

Users can still provide a commit sha value to override this behavior.

closes #372
@drazisil-codecov drazisil-codecov unpinned this issue Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants