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

Passing secrets.CODECOV_TOKEN not recognized #44

Closed
CasperWA opened this issue Dec 12, 2019 · 7 comments
Closed

Passing secrets.CODECOV_TOKEN not recognized #44

CasperWA opened this issue Dec 12, 2019 · 7 comments

Comments

@CasperWA
Copy link

CasperWA commented Dec 12, 2019

Having set up the secret CODECOV_TOKEN and passing it as ${{ secrets.CODECOV_TOKEN }} the upload fails with the message:

HTTP 400
Please provide the repository token to upload reports via `-t :repository-token`

This is both for v1 and v1.0.5 of codecov-action.

It seems that the action's environment variable CODECOV_TOKEN is not set properly or not recognized?

It should be mentioned that this has recently started failing, without changing the actions workflow otherwise, i.e., it used to work, but now throws this error.

@CasperWA
Copy link
Author

Is it the case that this may fail if the secret is set for the main owner, but not a fork, during a PR from the fork to the main owner (upstream repo)?

@CasperWA
Copy link
Author

So it seems the reason for this is a lack of support for token-less uploads to codecov for Github Actions. Something that seemingly exists for other CI services, e.g., Travis.

If you do not consider this an issue of this repo, which is fair, then please close this issue.
I do think, however that it is worth mentioning this in the README, clarifying that if one wants to upload using a GitHub secret, then one needs to have the secret in the (forked) repository that contains the branch, since these are the ones running the Actions - even for PRs to an upstream branch.
At the moment this information is not easily gleened, and it is not likely that this behaviour will (or should) change for GitHub Actions, since it could allow for security risks, e.g., exposing other owner's secrets.

I hope codecov will implement a token-free, secure upload mechanism for GH Actions soon.

@ibrahim0814
Copy link
Contributor

ibrahim0814 commented Dec 17, 2019

Hi @CasperWA, thanks for bringing this up! You're right, secrets are not available for forks of repositories, therefore the token wasn't available when you tried to upload to Codecov from the forked repository. I'll push an update to our readme soon because it's definitely worth clarifying

With regards to tokenless uploads, we do plan to support them when GitHub releases an API for Actions around early 2020.

@ibrahim0814
Copy link
Contributor

@CasperWA I've added a notice for this issue in here and will now close this thread

DentonGentry added a commit to ProjectDrawdown/solutions that referenced this issue Feb 27, 2020
Codecov has to be skipped because the secret isn't available.

codecov.io understands that this is an issue which needs a better
resolution: codecov/codecov-action#44
DentonGentry added a commit to ProjectDrawdown/solutions that referenced this issue Feb 27, 2020
Codecov has to be skipped because the secret isn't available.

codecov.io understands that this is an issue which needs a better
resolution: codecov/codecov-action#44
DentonGentry added a commit to ProjectDrawdown/solutions that referenced this issue Feb 27, 2020
Codecov has to be skipped because the secret isn't available.

codecov.io understands that this is an issue which needs a better
resolution: codecov/codecov-action#44
DentonGentry added a commit to ProjectDrawdown/solutions that referenced this issue Feb 27, 2020
Codecov has to be skipped because the secret isn't available in pull
requests from forks, but we want to run the rest of the workflow.
This means that coverage will not be updated until the next pull_request
from the main repository... which is not ideal, as we may not realize it
was the earlier pull_request which impacted coverage.

codecov.io understands that this is an issue which needs a better
resolution: codecov/codecov-action#44
@frgfm
Copy link

frgfm commented Sep 11, 2020

Hi @ibrahim0814,

Are we positive this issue is actually solved? I first thought it was just a one-day server issue but I'm consistently getting this error on coverage upload for my public repos (latest error being https://github.com/frgfm/Holocron/pull/79/checks?check_run_id=1102442559).

I haven't changed my coverage report generation and upload job for months, it just started throwing errors at some point. But maybe I did something wrong?

Any input would be appreciated!

@thomasrockhu
Copy link
Contributor

@frgfm please upgrade to the latest version of the action and let me know if that doesn't work.

@frgfm
Copy link

frgfm commented Sep 11, 2020

@thomasrockhu Oh thanks! Reading about the issue earlier in other discussions, switching to the latest version didn't seem to help them. But apparently I should have tried it out, because it works!

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

4 participants