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

[v4] Error: Codecov token not found in a PR from a fork to a pubilc repo #1292

Closed
Tracked by #273
jishnub opened this issue Feb 13, 2024 · 26 comments
Closed
Tracked by #273

Comments

@jishnub
Copy link

jishnub commented Feb 13, 2024

My understanding was that a token would not be required when creating a PR from a fork to a public, open-source project. However, in the run https://github.com/JuliaMath/FFTW.jl/actions/runs/7854977161/job/21436255573?pr=295, I encounter

Run codecov/codecov-action@v4
  with:
    fail_ci_if_error: true
    file: lcov.info
  env:
    JULIA_NUM_THREADS: 2
    JULIA_PKG_SERVER_REGISTRY_PREFERENCE: eager
==> windows OS detected
https://cli.codecov.io/latest/windows/codecov.exe.SHA256SUM
==> Running version latest
==> Running version v0.4.6
==> Running command 'D:\a\_actions\codecov\codecov-action\v4\dist\codecov.exe create-commit'
D:\a\_actions\codecov\codecov-action\v4\dist\codecov.exe create-commit -C 798f370e7c6e3cf60fbf6866b3a1b9d36e4db012 -Z
gpg: directory '/c/Users/runneradmin/.gnupg' created
gpg: keybox '/c/Users/runneradmin/.gnupg/pubring.kbx' created
gpg: /c/Users/runneradmin/.gnupg/trustdb.gpg: trustdb created
gpg: key 806BB28AED779869: public key "Codecov Uploader (Codecov Uploader Verification Key) <[email protected]>" imported
gpg: Total number processed: 1
gpg:               imported: 1

info - 2024-02-10 12:50:54,352 -- ci service found: github-actions
gpg: Signature made Fri Feb  2 14:15:51 2024 CUT
gpg:                using RSA key 27034E7FDB850E0BBC2C62FF806BB28AED779869
gpg: Good signature from "Codecov Uploader (Codecov Uploader Verification Key) <[email protected]>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 2703 4E7F DB85 0E0B BC2C  62FF 806B B28A ED77 9869

==> Uploader SHASUM verified (64a905e31c4ab88dd999052685656280bc68dafc6bbaaed941a68e6d6a00f24c  codecov.exe)
warning - 2024-02-10 12:50:54,410 -- No config file could be found. Ignoring config.
Error: Codecov token not found. Please provide Codecov token with -t flag.
Error: Codecov: Failed to properly create commit: The process 'D:\a\_actions\codecov\codecov-action\v4\dist\codecov.exe' failed with exit code 1

Other runs in the matrix do succeed without a token, e.g. https://github.com/JuliaMath/FFTW.jl/actions/runs/7854977161/job/21436254781?pr=295, as is expected.

@rohan-at-sentry
Copy link
Contributor

@jishnub thanks for reaching out. We can take a look

@rohan-at-sentry
Copy link
Contributor

@jishnub are you able to request the failing run to be re-run just to confirm?

We suspect that at the time the action ran, we hit Github rate limits which caused our check (to verify if the source was a fork) to fail

@clemenscodes
Copy link

Getting the same error on a public repo as well when using v4, using v3 works fine.

@JoseLion
Copy link

I'm getting the same issue when using the workflow with workflow_call: from another workflow in the same repo. Public repo as well, and I do have the token: ${{ secrets.CODECOV_TOKEN }} argument set.

I noticed that when the workflow is triggered by push: or pull_request:, the token argument is present:
image

But when the workflow is triggered by workflow_call: from another workflow, the token argument is missing:
image

@rohan-at-sentry
Copy link
Contributor

@clemenscodes can you point me to the run where this happened?

@clemenscodes
Copy link

@jishnub
Copy link
Author

jishnub commented Feb 13, 2024

@jishnub are you able to request the failing run to be re-run just to confirm?

I can confirm re-running the job does not lead to the issue, so it could certainly be a rate limit. It's just a bit puzzling when jobs fail at random. Perhaps the error message may be improved?

@rohan-at-sentry
Copy link
Contributor

Thanks @jishnub - yeah we're working on fixing the error messaging around rate limits (not just on the CLI, but all other user facing touchpoints - PR, UI etc)

@rohan-at-sentry
Copy link
Contributor

@JoseLion @clemenscodes if you can open a different issue, while I take a look that would be appreciated. This will help me track better. FWIW @clemenscodes - my understanding is that it looks to be separate from this issue (which is about forks).

Closing this as the original issue is resolved

@georgebv
Copy link

georgebv commented Feb 14, 2024

Getting the same error in my own public repo when running v4 triggered by a release event on main branch. You can see verbose logs here: https://github.com/georgebv/drf-pydantic/actions/runs/7896620245/job/21550933382

As you can see, re-running (once) didn't help.

Rolling back to v3 solved this.

@terabytesoftw
Copy link

The error persists, we had to downgrade to v3.

JoshuaKGoldberg added a commit to JoshuaKGoldberg/create-typescript-app that referenced this issue Feb 14, 2024
## PR Checklist

- [x] Addresses an existing open issue: fixes #1303
- [x] That issue was marked as [`status: accepting
prs`](https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22)
- [x] Steps in
[CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/create-typescript-app/blob/main/.github/CONTRIBUTING.md)
were taken

## Overview

codecov/codecov-action#1292 &
codecov/feedback#273 make me not want to deal
with this token stuff until it's all resolved.

Things were working fine before, and I really don't want to add a
_third_ token requirement to repos made with `create-typescript-app`.
@wsanchez
Copy link

@kiraware
Copy link

Me to here https://github.com/kiraware/paspybin/actions/runs/7911211535/job/21595033660. It would be nice if codecov failing the workflow not just passed as everything is ok.

@carlosmondra
Copy link

carlosmondra commented Feb 15, 2024

Me to here https://github.com/kiraware/paspybin/actions/runs/7911211535/job/21595033660. It would be nice if codecov failing the workflow not just passed as everything is ok.

@kiraware Are you passing the param fail_ci_if_error: true?

@kiraware
Copy link

kiraware commented Feb 16, 2024

Me to here https://github.com/kiraware/paspybin/actions/runs/7911211535/job/21595033660. It would be nice if codecov failing the workflow not just passed as everything is ok.

@kiraware Are you passing the param fail_ci_if_error: true?

@carlosmondra nice point, i miss the docs. Thanks for pointing it.

And for everyone, I was surprised because codecov gave the wrong guide, here is an example of the guide I got when setting up a new repo
Screenshot 2024-02-16 at 08-59-54 Code coverage done right

as you can see, it should using with instead of env. Based on the readme stated

steps:
- uses: actions/checkout@master
- uses: codecov/codecov-action@v4
  with:
    fail_ci_if_error: true # optional (default = false)
    files: ./coverage1.xml,./coverage2.xml # optional
    flags: unittests # optional
    name: codecov-umbrella # optional
    token: ${{ secrets.CODECOV_TOKEN }} # required
    verbose: true # optional (default = false)

and via environment variable

steps:
- uses: actions/checkout@master
- uses: codecov/codecov-action@v4
  with:
    fail_ci_if_error: true # optional (default = false)
    files: ./coverage1.xml,./coverage2.xml # optional
    flags: unittests # optional
    name: codecov-umbrella # optional
    verbose: true # optional (default = false)
  env:
    CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

Again, it was my fault not read the docs. But the guide needs to be fixed soon. Thanks.

@wheeheee
Copy link

On the DSP.jl repo, this happens suspiciously often on macos-latest. 5 / 6 of the most recent Codecov failures are on this platform (2 in a matrix of 8).
https://github.com/JuliaDSP/DSP.jl/actions/runs/7989226135/job/21815388948
(some are hidden behind re-runs)

hoh added a commit to aleph-im/pyaleph that referenced this issue Feb 21, 2024
@jayqi
Copy link

jayqi commented Feb 21, 2024

I'm getting the Error: Codecov token not found. on a PR from Dependabot on my repo. I'm not exactly sure how Dependabot works, but GitHub Actions appears to be treating it as a public fork as it's not passing in my token. I've tried rerunning my workflow five times over 3 days, and I'm still getting an error.

https://github.com/jayqi/failed-build-issue-action/actions/runs/7964800022/job/21822931777

https://github.com/jayqi/failed-build-issue-action/blob/92418847f91ab409c250460723b5b5f5487a8d48/.github/workflows/tests.yml#L31-L35

@kristof-mattei
Copy link

@JoseLion to get secrets passed on to a workflow_call you need to expose the secrets explicitly, either individually or as inherit: https://docs.github.com/en/actions/using-workflows/reusing-workflows#using-inputs-and-secrets-in-a-reusable-workflow

I just ran into the same issue.

@Czaki
Copy link

Czaki commented Apr 11, 2024

is there a reason for why we need a token for public repos while we didn't before? that's creating a lot of churn/changes

They hit in limits of calling GitHub API required for identifying workflow run. If you upload with a token, they save GitHub API calls. Best will be if they will have higher limit, but it depends on GitHub itself.

@superical
Copy link

After spending over an hour grappling with this issue, it seems like my problem was with the token (which is stored as a secret) missing in codecov when triggering via a workflow_call. I'm not sure why it has worked all along until today.

For anyone facing the same problem, my workaround is passing the secret from the caller job into the workflow job. This allows codecov to receive the token. Here's the change that did the trick for me: https://github.com/Open-Attestation/document-store/pull/170/files

I believe you only have to pass the token input to codecov if you aren't using a workflow_call like I did.

@Czaki
Copy link

Czaki commented Apr 16, 2024

For anyone facing the same problem, my workaround is passing the secret from the caller job into the workflow job

It is not workaround but official way to do this (I face same problem a week ago) https://github.com/napari/napari/pull/6701/files

It is in documentation, but not clearly written.

@superical
Copy link

Ah... Glad to know that it's the official way to do it.👍

Is this even mentioned in the documentation? I didn't find anything about this issue. I ended up trying different methods just to pass the token into the action.

@Czaki
Copy link

Czaki commented Apr 16, 2024

https://docs.github.com/en/actions/using-workflows/reusing-workflows#using-inputs-and-secrets-in-a-reusable-workflow

https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onworkflow_callsecrets

Note: If you are passing the secret to a nested reusable workflow, then you must use jobs.<job_id>.secrets again to pass the secret. For more information, see "Reusing workflows."

manning-ncsa added a commit to scimma/blast that referenced this issue Apr 28, 2024
manning-ncsa added a commit to scimma/blast that referenced this issue May 4, 2024
commit 337b877
Merge: 4763792 a658993
Author: David Jones <[email protected]>
Date:   Mon Apr 29 17:05:43 2024 -1000

    Merge pull request #223 from astrophpeter/djones-cutout-fixes-2

    one more cutout problem

commit a658993
Author: David Jones <[email protected]>
Date:   Mon Apr 29 17:04:05 2024 -1000

    one more cutout problem

commit 4763792
Merge: ac8c6a1 ed637ec
Author: David Jones <[email protected]>
Date:   Mon Apr 29 16:41:21 2024 -1000

    Merge pull request #222 from astrophpeter/djones-tasks

    Djones tasks

commit ed637ec
Merge: de1126b 4f3619e
Author: David Jones <[email protected]>
Date:   Mon Apr 29 16:39:41 2024 -1000

    removing debug lines, and merge conflicts

commit de1126b
Author: David Jones <[email protected]>
Date:   Mon Apr 29 16:37:36 2024 -1000

    removed debug lines

commit 4f3619e
Author: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Date:   Tue Apr 30 02:37:13 2024 +0000

    [pre-commit.ci] auto fixes from pre-commit.com hooks

    for more information, see https://pre-commit.ci

commit ad7e0ee
Author: David Jones <[email protected]>
Date:   Mon Apr 29 16:35:39 2024 -1000

    task prereqs and a couple speed enhancements

commit ac8c6a1
Merge: 4644ee8 4cb7c21
Author: T. Andrew Manning <[email protected]>
Date:   Mon Apr 29 15:09:37 2024 -0500

    Merge pull request #219 from astrophpeter/favicon

    Add favicon

commit 05e8b79
Merge: f05501d 4644ee8
Author: David Jones <[email protected]>
Date:   Mon Apr 29 07:47:55 2024 -1000

    Merge branch 'main' of github.com:astrophpeter/blast

commit f05501d
Author: David Jones <[email protected]>
Date:   Mon Apr 29 07:47:51 2024 -1000

    task orders

commit 4644ee8
Merge: 6c74b7d b2f6e77
Author: T. Andrew Manning <[email protected]>
Date:   Mon Apr 29 11:21:56 2024 -0500

    Merge pull request #221 from astrophpeter/bokeh-update

    Bokeh update

commit b2f6e77
Author: T. Andrew Manning <[email protected]>
Date:   Mon Apr 29 11:18:16 2024 -0500

    Update base deps image

commit 84ade12
Merge: c8473f7 3e61e0b
Author: T. Andrew Manning <[email protected]>
Date:   Mon Apr 29 10:52:22 2024 -0500

    Merge branch 'bokeh-update' of github.com:astrophpeter/blast into bokeh-update

commit 3e61e0b
Author: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Date:   Mon Apr 29 15:51:03 2024 +0000

    [pre-commit.ci] auto fixes from pre-commit.com hooks

    for more information, see https://pre-commit.ci

commit c8473f7
Merge: 3a08c21 6781117
Author: T. Andrew Manning <[email protected]>
Date:   Mon Apr 29 10:50:38 2024 -0500

    Merge branch 'bokeh-update' of github.com:astrophpeter/blast into bokeh-update

commit 3a08c21
Author: T. Andrew Manning <[email protected]>
Date:   Mon Apr 29 10:50:30 2024 -0500

    Auto-scale home page bar graph

commit 6781117
Author: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Date:   Mon Apr 29 15:48:40 2024 +0000

    [pre-commit.ci] auto fixes from pre-commit.com hooks

    for more information, see https://pre-commit.ci

commit c457203
Author: T. Andrew Manning <[email protected]>
Date:   Mon Apr 29 10:40:22 2024 -0500

    Fix layout problems related to Bootstrap and Bokeh updates

commit 6898500
Author: T. Andrew Manning <[email protected]>
Date:   Mon Apr 29 10:39:19 2024 -0500

    Upgrade to bokeh==3.4.1 and address deprecation warnings

commit 3738052
Author: T. Andrew Manning <[email protected]>
Date:   Mon Apr 29 10:33:05 2024 -0500

    Remove unused imports in plotting_utils.py

commit 4cb7c21
Author: T. Andrew Manning <[email protected]>
Date:   Mon Apr 29 10:29:38 2024 -0500

    Add favicon

commit 6c74b7d
Merge: 63ba456 dda28b0
Author: T. Andrew Manning <[email protected]>
Date:   Sun Apr 28 21:57:11 2024 -0500

    Merge pull request #214 from astrophpeter/silk

commit dda28b0
Merge: b4f331e 63ba456
Author: T. Andrew Manning <[email protected]>
Date:   Sun Apr 28 21:49:27 2024 -0500

    Merge branch 'main' into silk

commit 63ba456
Merge: a1b66ab 5032312
Author: T. Andrew Manning <[email protected]>
Date:   Sun Apr 28 21:48:45 2024 -0500

    Merge pull request #176 from astrophpeter/dependabot/github_actions/docker/build-push-action-4

    Bump docker/build-push-action from 3 to 4

commit b4f331e
Merge: 36289d3 a1b66ab
Author: T. Andrew Manning <[email protected]>
Date:   Sun Apr 28 17:08:00 2024 -0500

    Merge branch 'main' into silk

commit a1b66ab
Merge: 310d725 051d6ab
Author: T. Andrew Manning <[email protected]>
Date:   Sun Apr 28 17:07:04 2024 -0500

    Merge pull request #213 from astrophpeter/formatting

    Address formatting issues

commit 051d6ab
Author: T. Andrew Manning <[email protected]>
Date:   Sun Apr 28 17:04:09 2024 -0500

    Remove CI workflow until a working version is created.

    codecov action is pointless without the coverage.xml
    file generated by unit test script.

commit 8f28ab0
Author: T. Andrew Manning <[email protected]>
Date:   Sun Apr 28 16:59:03 2024 -0500

    Revert to codecov/codecov-action@v3

    See codecov/codecov-action#1292

commit e42acd9
Author: T. Andrew Manning <[email protected]>
Date:   Sun Apr 28 16:56:06 2024 -0500

    Send pre-commit.ci autoupdate PRs to dedicated branch

commit 869edfc
Author: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Date:   Sun Apr 28 21:38:20 2024 +0000

    [pre-commit.ci] auto fixes from pre-commit.com hooks

    for more information, see https://pre-commit.ci

commit f2d5bf4
Author: T. Andrew Manning <[email protected]>
Date:   Sun Apr 28 16:37:48 2024 -0500

    Downgrade Black to v23.12.1 in pre-commit config

commit 36289d3
Author: T. Andrew Manning <[email protected]>
Date:   Sun Apr 28 16:16:53 2024 -0500

    Add SILKY_INTERCEPT_PERCENT env var

commit 5032312
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Tue Jan 31 10:05:08 2023 +0000

    Bump docker/build-push-action from 3 to 4

    Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 3 to 4.
    - [Release notes](https://github.com/docker/build-push-action/releases)
    - [Commits](docker/build-push-action@v3...v4)

    ---
    updated-dependencies:
    - dependency-name: docker/build-push-action
      dependency-type: direct:production
      update-type: version-update:semver-major
    ...

    Signed-off-by: dependabot[bot] <[email protected]>
@thomasrockhu-codecov
Copy link
Contributor

I think the original issue here has been resolved so closing for now. If there is still more to respond to, please create a new issue.

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