You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

GitHub Actions中Codecov上传步骤无法找到令牌的问题排查

问题背景

我维护的公开GitHub仓库「ncompare」一直使用GitHub Actions及codecov-action,但近期测试工作流中的Codecov上传步骤出现令牌未找到的错误,令牌已以“CODECOV_TOKEN”为名存储为仓库密钥。

错误分为两种形式:
第一种(v4版本action报错):

debug - 2024-04-09 13:05:05,527 -- Starting create commit process --- {"commit_sha": "dc6df2f3530a6c18f6b23ab63a8549754fae6e1f", "parent_sha": null, "pr": null, "branch": "develop", "slug": "nasa/ncompare", "token": null, "service": "github", "enterprise_url": null}
Error: Codecov token not found. Please provide Codecov token with -t flag.
Error: Codecov: Failed to properly create commit: The process '/home/runner/work/_actions/codecov/codecov-action/v4/dist/codecov' failed with exit code 1

第二种(v3版本action报错):

[2024-04-08T18:04:32.790Z] ['info'] Pinging Codecov: https://codecov.io/upload/v4?package=github-action-3.1.6-uploader-0.7.2&token=*******&branch=develop&build=8604645331&build_url=https%3A%2F%2Fgithub.com%2Fnasa%2Fncompare%2Factions%2Fruns%2F8604645331&commit=0c5f7f070497072c670fca7cb4a65d97a4b6ce25&job=CI&pr=&service=github-actions&slug=nasa%2Fncompare&name=&tag=&flags=&parent=
[2024-04-08T18:04:32.790Z] ['verbose'] Passed token was 0 characters long
[2024-04-08T18:04:32.790Z] ['verbose'] https://codecov.io/upload/v4?package=github-action-3.1.6-uploader-0.7.2&branch=develop&build=8604645331&build_url=https%3A%2F%2Fgithub.com%2Fnasa%2Fncompare%2Factions%2Fruns%2F8604645331&commit=0c5f7f070497072c670fca7cb4a65d97a4b6ce25&job=CI&pr=&service=github-actions&slug=nasa%2Fncompare&name=&tag=&flags=&parent=
        Content-Type: 'text/plain'
        Content-Encoding: 'gzip'
        X-Reduced-Redundancy: 'false'
[2024-04-08T18:04:32.989Z] ['error'] There was an error running the uploader: Error uploading to https://codecov.io: Error: There was an error fetching the storage URL during POST: 404 - {'detail': ErrorDetail(string='Unable to locate build via Github Actions API. Please upload with the Codecov repository upload token to resolve issue.', code='not_found')}
[2024-04-08T18:04:32.990Z] ['verbose'] The error stack is: Error: Error uploading to https://codecov.io: Error: There was an error fetching the storage URL during POST: 404 - {'detail': ErrorDetail(string='Unable to locate build via Github Actions API. Please upload with the Codecov repository upload token to resolve issue.', code='not_found')}
    at main (/snapshot/repo/dist/src/index.js)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[2024-04-08T18:04:32.990Z] ['verbose'] End of uploader: 552 milliseconds
Error: Codecov: Failed to properly upload: The process '/home/runner/work/_actions/codecov/codecov-action/v3/dist/codecov' failed with exit code 255
已尝试的解决措施
  • 切换使用codecov-action的v3和v4版本
  • 重新生成并保存新的CODECOV令牌
  • 尝试两种参数配置语法:
    with:
      token: ${{ secrets.CODECOV_TOKEN }}
    
    env:
      CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
    

内容的提问来源于stack exchange,提问作者Danny Kaufman

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.26 06:05:55