Repository navigation
fix(ci): skip Codecov upload when CODECOV_TOKEN is not configured - #162
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
Coverage工作流自 2026-10-04 起每次运行都红灯(push 与每周一 schedule 均失败):Upload coverage to Codecov(coverage.yml:49)。GHCR_PRUNE_TOKEN,CODECOV_TOKEN未配置(gh secret list已确认)。secrets.CODECOV_TOKEN展开为空串 → 上传被拒 →fail_ci_if_error: true使整个 job 失败。Coverage从 10-04 起持续红(最近 4 次运行:a3a7fb8/5b85954/49a4b43(push) /49a4b43(schedule) +0893061全部 failure),且每周一还会继续红;覆盖率数据事实上从未上传成功。修复
沿用仓库已有的
GHCR_PRUNE_TOKEN模式(见docker.yml:110、ghcr-prune.yml:21):Upload coverage to Codecov增加if: ${{ env.CODECOV_TOKEN != '' }},token 传入改用env.CODECOV_TOKEN;Coverage upload skipped步骤(if: ... == ''):打印::notice::并写入 Step Summary,明确暴露「尚未接入 Codecov」而不是静默跳过;fail_ci_if_error: true保持不变 —— 一旦配置 token,上传失败(过期 / 网络 / 策略)依旧红灯,门禁语义不受影响;lcov.info),只是不自动上传。顺带:合并
CHANGELOG.md顶部重复的## [Unreleased]标题(同文件被重复插入了两次)。验证
bash scripts/test-actions-pinning.sh→ 通过(所有 action 仍为 40 位 SHA 固定)bash scripts/test-release-workflow-security.sh→ 通过coverage.ymlYAML 解析通过,step 级if使用env上下文(GitHub 允许)workflow_dispatch的 Coverage 运行,用于端到端确认「无 token → 跳过上传且 job 绿」:见 Actions 运行记录后续(需要仓库管理员操作)
若要真正启用覆盖率门禁:
再把
codecov/project、codecov/patch加入分支保护的 required checks。