Skip to content

fix(ci): authenticate Codecov uploads with a repository token - #56

Merged
futamura merged 5 commits into
developfrom
fix/codecov-oidc-upload
Aug 20, 2026
Merged

fix(ci): authenticate Codecov uploads with a repository token#56
futamura merged 5 commits into
developfrom
fix/codecov-oidc-upload

Conversation

@futamura

Copy link
Copy Markdown
Owner

目的

main push で走る coverage.yml が全 5 job で Upload ... to Codecov step のみ失敗し、workflow 全体が赤くなっていた問題を修正する (project memory の task 33)。

原因

Codecov の upload service が本 repository を旧 owner 名 gumob/fluidable で index したままだった。OIDC / tokenless upload は CI が報告する slug futamura/Fluidable で repo を解決するため、この index に該当が無く 404 Repository not found を返していた。

read 側 (dashboard, api.codecov.io/api/v2) は owner rename を追従済みで repo を正常に返すため、当初「repo 未登録」と誤診されていた。

ubuntu runner 上の一時 probe workflow で 6 通りを 14 秒 / run で検証した。

probe 設定 結果
1 OIDC のみ 404
2 OIDC + slug 明示 404
3 OIDC + legacy upload endpoint 404
4 OIDC claim 検査 claim は正常。repository_owner_id も GitHub と一致
5 tokenless 404
6 repository upload token 200

probe 6 の結果 URL が https://app.codecov.io/github/gumob/fluidable/commit/... を指しており、record 名が旧 owner のままであることが確定した。

主要変更点

  • coverage.yml の Codecov step 2 箇所を use_oidc: true から token: ${{ secrets.CODECOV_TOKEN }} へ変更
  • OIDC 専用だった id-token: write permission を削除
  • CODECOV_TOKEN を repository secret として設定 (値は非公開)

Verification

  • gh workflow run coverage.yml --ref fix/codecov-oidc-upload -> run 32345046410全 5 job success。upload step 5 件すべて success
  • Codecov API で対象 commit が state: complete / ci_passed: true / coverage: 89.8 / files: 107
  • 初回 attempt の unit-coverage は既知の blur snapshot flake (Tests/UIKitSpec.swift:1482) で失敗。gh run rerun --failed で success。本変更とは無関係

UI 変更なし。Swift / Storyboard / layout / transition に触れないため Simulator 確認は不要。

既知の制約

OIDC へ戻すには Codecov 側で upload service の repo record を futamura/Fluidable へ更新してもらう必要があり、こちら側の設定では不可能。

Reproduce the `Repository not found` upload failure on a cheap ubuntu
runner instead of the 5-job macOS coverage matrix. Runs three variants in
one job: plain OIDC, OIDC with an explicit slug, and OIDC against the
legacy upload endpoint. Temporary; removed once the cause is identified.
Probes 1-3 ruled out slug derivation and the upload endpoint: an explicit
slug and the legacy endpoint both return the same 404. Add a tokenless
upload probe to test whether the OIDC path alone is broken, and a claim
inspection step that prints only non-secret OIDC claims.
The Codecov GitHub App is installed with access to this repo and the
dashboard shows the repo, so the remaining cause matches codecov-action
issue 1965: the account record no longer matches after the Harness
migration. Probe the repository upload token path now that the account
has been re-onboarded and the secret is set.
The Codecov upload service still indexes this repository under its former
owner name, `gumob/fluidable`. OIDC and tokenless uploads resolve the repo
by the slug the CI reports, `futamura/Fluidable`, which that index does not
contain, so every upload returned 404 `Repository not found`. A repository
upload token resolves the record directly and is unaffected by the stale
name.

Drop the `id-token: write` permission, which only OIDC needed.
The probe identified the cause and confirmed the fix: `coverage.yml` now
uploads with a repository token and all five jobs report to Codecov.
@futamura
futamura merged commit f1d5f65 into develop Aug 20, 2026
1 check passed
@futamura
futamura deleted the fix/codecov-oidc-upload branch August 20, 2026 08:24
@futamura futamura mentioned this pull request Aug 21, 2026
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

Successfully merging this pull request may close these issues.

1 participant