Skip to content

Commit d820d60

Browse files
feat: allow for authentication via OIDC token (#1330)
* fix: allow for oidc token * chore(docs): update docs with use_oidc argument * Update action.yml Co-authored-by: Cristian Le <[email protected]> * chore(release): 4.2.0 --------- Co-authored-by: Cristian Le <[email protected]>
1 parent 3a20752 commit d820d60

File tree

10 files changed

+351
-279
lines changed

10 files changed

+351
-279
lines changed

.eslintrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"@typescript-eslint"
1818
],
1919
"rules": {
20+
"max-len": ["error", { "code": 120 }],
2021
"linebreak-style": 0
2122
}
2223
}

README.md

Lines changed: 44 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -64,44 +64,56 @@ steps:
6464
> [!NOTE]
6565
> This assumes that you've set your Codecov token inside *Settings > Secrets* as `CODECOV_TOKEN`. If not, you can [get an upload token](https://docs.codecov.io/docs/frequently-asked-questions#section-where-is-the-repository-upload-token-found-) for your specific repo on [codecov.io](https://www.codecov.io). Keep in mind that secrets are *not* available to forks of repositories.
6666

67+
### Using OIDC
68+
For users with [OpenID Connect(OIDC) enabled](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect), the Codecov token is not necessary. You can use OIDC with the `use_oidc` argument as following.
69+
70+
```yaml
71+
- uses: codecov/codecov-action@v4
72+
with:
73+
use_oidc: true
74+
```
75+
76+
Any token supplied will be ignored, as Codecov will default to the OIDC token for verification.
77+
6778
## Arguments
6879

6980
Codecov's Action supports inputs from the user. These inputs, along with their descriptions and usage contexts, are listed in the table below:
7081

7182
| Input | Description | Required |
7283
| :--- | :--- | :---: |
73-
| `token` | Repository Codecov token. Used to authorize report uploads | *Required
74-
| `codecov_yml_path` | Specify the path to the Codecov YML | Optional
75-
| `commit_parent` | Override to specify the parent commit SHA | Optional
76-
| `directory` | Directory to search for coverage reports. | Optional
77-
| `disable_search` | Disable search for coverage files. This is helpful when specifying what files you want to upload with the --file option. | Optional
78-
| `disable_file_fixes` | Disable file fixes to ignore common lines from coverage (e.g. blank lines or empty brackets) | Optional
79-
| `dry_run` | Don't upload files to Codecov | Optional
80-
| `env_vars` | Environment variables to tag the upload with (e.g. PYTHON \| OS,PYTHON) | Optional
81-
| `exclude` | Folders to exclude from search | Optional
82-
| `fail_ci_if_error` | Specify whether or not CI build should fail if Codecov runs into an error during upload | Optional
83-
| `file` | Path to coverage file to upload | Optional
84-
| `files` | Comma-separated list of files to upload | Optional
85-
| `flags` | Flag upload to group coverage metrics (e.g. unittests \| integration \| ui,chrome) | Optional
86-
| `handle_no_reports_found` | Raise no exceptions when no coverage reports found | Optional
87-
| `job_code` | The job code | Optional
88-
| `name` | User defined upload name. Visible in Codecov UI | Optional
89-
| `os` | Override the assumed OS. Options are linux \| macos \| windows \| . | Optional
90-
| `override_branch` | Specify the branch name | Optional
91-
| `override_build` | Specify the build number | Optional
92-
| `override_build_url` | The URL of the build where this is running | Optional
93-
| `override_commit` | Specify the commit SHA | Optional
94-
| `override_pr` | Specify the pull request number | Optional
95-
| `plugin` | plugins to run. Options: xcode, gcov, pycoverage. The default behavior runs them all. | Optional
96-
| `plugins` | Comma-separated list of plugins for use during upload. | Optional
97-
| `report_code` | The code of the report. If unsure, do not include | Optional
98-
| `root_dir` | Used to specify the location of your .git root to identify project root directory | Optional
99-
| `slug` | Specify the slug manually (Enterprise use) | Optional
100-
| `url` | Specify the base url to upload (Enterprise use) | Optional
101-
| `use_legacy_upload_endpoint` | Use the legacy upload endpoint | Optional
102-
| `verbose` | Specify whether the Codecov output should be verbose | Optional
103-
| `version` | Specify which version of the Codecov CLI should be used. Defaults to `latest` | Optional
104-
| `working-directory` | Directory in which to execute codecov.sh | Optional
84+
| `token` | Repository Codecov token. Used to authorize report uploads | *Required
85+
| `codecov_yml_path` | Specify the path to the Codecov YML | Optional
86+
| `commit_parent` | Override to specify the parent commit SHA | Optional
87+
| `directory` | Directory to search for coverage reports. | Optional
88+
| `disable_search` | Disable search for coverage files. This is helpful when specifying what files you want to upload with the --file option. | Optional
89+
| `disable_file_fixes` | Disable file fixes to ignore common lines from coverage (e.g. blank lines or empty brackets) | Optional
90+
| `dry_run` | Don't upload files to Codecov | Optional
91+
| `env_vars` | Environment variables to tag the upload with (e.g. PYTHON \| OS,PYTHON) | Optional
92+
| `exclude` | Folders to exclude from search | Optional
93+
| `fail_ci_if_error` | Specify whether or not CI build should fail if Codecov runs into an error during upload | Optional
94+
| `file` | Path to coverage file to upload | Optional
95+
| `files` | Comma-separated list of files to upload | Optional
96+
| `flags` | Flag upload to group coverage metrics (e.g. unittests \| integration \| ui,chrome) | Optional
97+
| `handle_no_reports_found` | Raise no exceptions when no coverage reports found | Optional
98+
| `job_code` | The job code | Optional
99+
| `name` | User defined upload name. Visible in Codecov UI | Optional
100+
| `os` | Override the assumed OS. Options are linux \| macos \| windows \| . | Optional
101+
| `override_branch` | Specify the branch name | Optional
102+
| `override_build` | Specify the build number | Optional
103+
| `override_build_url` | The URL of the build where this is running | Optional
104+
| `override_commit` | Specify the commit SHA | Optional
105+
| `override_pr` | Specify the pull request number | Optional
106+
| `plugin` | plugins to run. Options: xcode, gcov, pycoverage. The default behavior runs them all. | Optional
107+
| `plugins` | Comma-separated list of plugins for use during upload. | Optional
108+
| `report_code` | The code of the report. If unsure, do not include | Optional
109+
| `root_dir` | Used to specify the location of your .git root to identify project root directory | Optional
110+
| `slug` | Specify the slug manually (Enterprise use) | Optional
111+
| `url` | Specify the base url to upload (Enterprise use) | Optional
112+
| `use_legacy_upload_endpoint` | Use the legacy upload endpoint | Optional
113+
| `use_oidc` | Use OpenID Connect for verification instead of token. This will ignore any token supplied. Please see [GitHub documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect) for details.
114+
| `verbose` | Specify whether the Codecov output should be verbose | Optional
115+
| `version` | Specify which version of the Codecov CLI should be used. Defaults to `latest` | Optional
116+
| `working-directory` | Directory in which to execute codecov.sh | Optional
105117

106118
### Example `workflow.yml` with Codecov Action
107119

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ inputs:
9595
use_legacy_upload_endpoint:
9696
description: 'Use the legacy upload endpoint'
9797
required: false
98+
use_oidc:
99+
description: 'Use OIDC instead of token. This will ignore any token supplied'
100+
default: false
98101
verbose:
99102
description: 'Specify whether the Codecov output should be verbose'
100103
required: false

0 commit comments

Comments
 (0)