-
Notifications
You must be signed in to change notification settings - Fork 153
ci: use OIDC for codecov-action #926
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,8 +1,8 @@ | ||||||||||||
| name: Python package | ||||||||||||
|
|
||||||||||||
| on: | ||||||||||||
| - push | ||||||||||||
| - pull_request | ||||||||||||
| - push | ||||||||||||
| - pull_request | ||||||||||||
|
|
||||||||||||
| jobs: | ||||||||||||
| build: | ||||||||||||
|
|
@@ -33,6 +33,8 @@ jobs: | |||||||||||
| uses: codecov/codecov-action@v5 | ||||||||||||
| env: | ||||||||||||
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||||||||||||
| with: | ||||||||||||
| use_oidc: true | ||||||||||||
| pass: | ||||||||||||
| needs: [build] | ||||||||||||
| runs-on: ubuntu-latest | ||||||||||||
|
|
@@ -42,3 +44,5 @@ jobs: | |||||||||||
| uses: re-actors/alls-green@release/v1 | ||||||||||||
| with: | ||||||||||||
| jobs: ${{ toJSON(needs) }} | ||||||||||||
| permissions: | ||||||||||||
| id-token: write | ||||||||||||
|
Comment on lines
+47
to
+48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result:
Sources: [1] GitHub Docs (enterprise/org default workflow permissions) • [2] GitHub Changelog (missing scopes => 🌐 Web query:
💡 Result:
Add one of these: Workflow-wide permissions:
contents: readJob-only jobs:
build:
permissions:
contents: readCommon gotcha: if you set any If you still can’t use Sources: [1] [2] [3] 🌐 Web query:
💡 Result: In a private GitHub repository, the default GitHub Actions
Citations:
Add When a Proposed change permissions:
+ contents: read
id-token: write📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
codecov/codecov-action v5 OIDC CODECOV_TOKEN required documentation💡 Result:
For
codecov/codecov-action@v5,CODECOV_TOKENis not required if you use OIDC.OIDC upload (no token): set
use_oidc: trueand grant the workflow/jobid-token: write. Anytoken/CODECOV_TOKENyou provide will be ignored when OIDC is enabled. [1]Token upload (when OIDC is not used): you may still need
CODECOV_TOKENdepending on your repo/org settings (e.g., private repos require a token, and public repos may require one for protected branches unless token authentication is disabled). [2]Sources: Codecov Action v5 README (OIDC section) [1]; Codecov “When do I need a token?” docs [2].
Remove CODECOV_TOKEN when using OIDC.
With
use_oidc: true, theCODECOV_TOKENenvironment variable is unnecessary and ignored. Exporting the secret keeps it in the runner environment without purpose. Remove theenvblock and consider deleting the secret from repo settings if no longer needed.Proposed change
📝 Committable suggestion
🤖 Prompt for AI Agents