Commit 7469b9c
feat(plugin-npm): support OIDC auth for CircleCI (#7075)
## What's the problem this PR addresses?
CircleCI was recently added as a supported [npm trusted
publisher](https://docs.npmjs.com/trusted-publishers) provider, but
Yarn's OIDC implementation only supports GitHub Actions and GitLab CI.
The upstream npm CLI already supports CircleCI in
[`lib/utils/oidc.js`](https://github.com/npm/cli/blob/latest/lib/utils/oidc.js)
(checking `ciInfo.CIRCLE`). Since Yarn's implementation was [adapted
from the npm
CLI](https://github.com/yarnpkg/berry/blob/7ccf6e3da18d77d36a426d004babf8553639defa/packages/plugin-npm/sources/npmHttpUtils.ts#L587-L591),
it should be updated to match.
Closes #7074.
## How did you fix it?
Added detection of the `CIRCLECI` environment variable in
`getOidcToken()`. Like GitLab CI, CircleCI sets the `NPM_ID_TOKEN`
environment variable, so the implementation follows the same pattern.
Note: The upstream npm CLI notes that CircleCI doesn't support
provenance yet, so the auto-provenance logic in #7017 / #7018 naturally
skips CircleCI (no visibility env var to check).
## Checklist
- [x] I have read the [Contributing
Guide](https://yarnpkg.com/advanced/contributing).
- [x] I have set the packages that need to be released for my changes to
be effective.
- [x] I will check that all automated PR checks pass before the PR gets
reviewed.
Co-authored-by: Maël Nison <nison.mael@gmail.com>1 parent 1ad7f4a commit 7469b9c
File tree
2 files changed
+26
-0
lines changed- .yarn/versions
- packages/plugin-npm/sources
2 files changed
+26
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
595 | 595 | | |
596 | 596 | | |
597 | 597 | | |
| 598 | + | |
| 599 | + | |
598 | 600 | | |
599 | 601 | | |
600 | 602 | | |
| |||
0 commit comments