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

test-coverage action is not up to date with codecov authentification policy and should already include CODECOV_TOKEN #822

Closed
ALanguillaume opened this issue Apr 11, 2024 · 6 comments
Labels
bug an unexpected problem or unintended behavior

Comments

@ALanguillaume
Copy link
Contributor

ALanguillaume commented Apr 11, 2024

Hi guys ! Thanks for the package. Just discovered this yesterday.

Describe the bug

test-coverage action is not up to date with codecov default authentication procedure.
For coverage results to be uploaded to codecov.io by covr::codecov() a code cov token needs to be available in the environment.
For example as a CODECOV_TOKEN secret.

To Reproduce

On a package repo :

usethis::use_tidy_package()
# Add some functions and tests 
usethis::use_coverage()
devtools::build_readme()
usethis::use_github_action("test-coverage")

Then push or make a PR to main or master

The test coverage job will succeed but your coverage badge will remain gray with an "Unknown" mention.

See this workflow

image

in order for the code coverage to be uploaded to codecov.

You need to click on the badge. You are then provided with a token.

This token should be included in a repository secret and defined in the env statement of the workflow as such:

 env:
      CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

See this commit

Once that done,

The coverage result was properly uploaded to codecov.io

See the corresponding workflow

image

Expected behavior

The env statement of the action test-coverage should already contained the following lines

 env:
      CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

and users should be notified on why and how to set this CODECOV_TOKEN as a repository secret.

Additional context

covr::codecov() should not failed silently. I will also open an issue in {covr}.

In my different trials I came to realize that the GITHUB_PAT defined in the workflow was not of any use.
The workflow runs successfully without it.

See this (commit)[https://github.com/ALanguillaume/test.cd.pkgdown.gh/commit/6ff28e63f8c5e35a67e96e1d7f44927bb5ceb178] and workflow

@ALanguillaume ALanguillaume added the bug an unexpected problem or unintended behavior label Apr 11, 2024
@gaborcsardi
Copy link
Member

Thanks for the investigation! Would you like to submit a PR to the example workflow?

@ALanguillaume
Copy link
Contributor Author

For the tweak in the yaml no prob.
usethis::use_github_action() should also be updated.
Do you want be to cross post this issue on {usethis} repo ?

@gaborcsardi
Copy link
Member

No, you only need to update the example workflow file in this repository.

@gaborcsardi
Copy link
Member

gaborcsardi commented Apr 11, 2024

For the record, this should work automatically, without a token. But Codedov is rate limited in their GitHub API usage, so it is best to create a token. Some details: https://community.codecov.com/t/upload-issues-unable-to-locate-build-via-github-actions-api/3954

@gaborcsardi
Copy link
Member

This is now fixed with the new @v2.9.0 release, which is also the new @v2.

Copy link

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue and include a link to this issue

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants