Repository navigation
feat: support GitHub Actions OIDC authentication - #411
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The snapshot includes ANSI color escapes that are absent from captured stderr when FORCE_COLOR is unset, causing the test to fail under the checked-in CI configuration.
1 open issue
What changed in this PR
Adds GitHub Actions OIDC authentication as an alternative to private keys for creating GitHub App installation tokens. The feature is not yet generally available.
Changes:
- Uses OIDC when
private-keyis omitted, requiringclient-idandid-token: write. - Preserves private-key authentication and rejects OIDC for enterprise installations.
- Adds OIDC tests and updates action metadata, snapshots, and the bundled entrypoint.
| File | Description |
|---|---|
tests/main-oidc-auth.test.js |
Tests OIDC token creation, scoping, outputs, and failures. |
tests/main-missing-private-key.test.js |
Tests missing private-key and OIDC credentials. |
tests/index.js.snapshot |
Updates expected authentication output and error formatting. |
main.js |
Requires an explicit client ID for OIDC authentication. |
lib/main.js |
Selects authentication mode and guards enterprise usage. |
lib/create-oidc-auth.js |
Adds OIDC-backed installation discovery and token requests. |
dist/main.cjs |
Bundles the new authentication behavior. |
action.yml |
Makes the private key optional and describes OIDC requirements. |
Review effort: Balanced
- Check for a private key or OIDC permissions before resolving the target, with an error that covers both a missing secret and missing id-token permissions - Add @ts-check and JSDoc to create-oidc-auth.js - Clarify the enterprise OIDC guard comment - Restore dist/main.cjs; the release workflow rebuilds it - Add missing trailing newlines Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
- Serve ID tokens from a local server instead of mocking @actions/core internals - Add OIDC support to the shared test helper and log request query strings - Move the ANSI stripping harness change to actions#412 Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Makes a missing private-key secret easy to spot in the logs when the workflow also grants id-token: write. Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
The failure is reported through the action's generic error handling, so the test covered no OIDC-specific behavior. Rename the owner test after what it uniquely checks: the audience derived from GITHUB_SERVER_URL. Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Strips ANSI escape codes from captured `stdout` and `stderr` before comparing test output to snapshots. When `FORCE_COLOR` is set (some terminals and tools set it), Node colorizes logged errors, so `main-token-get-owner-set-client-error.test.js` fails locally even though it passes in CI. With this change, snapshots match regardless of color settings. CI output is unchanged. Split out from #411. Co-authored-by: Aiqiao Yan <55104035+aiqiaoy@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
|
With |

Adds GitHub Actions OIDC as an alternative to a private key for authenticating as a GitHub App. This feature isn't generally available yet, so it targets the
betabranch for a pre-release.Changes
private-keyis now optional. When it's omitted, the action requests an Actions OIDC token (audience<GITHUB_SERVER_URL>/login/oauth) and uses it withclient_idto look up the installation and create the installation access token.No 'private-key' provided; authenticating with GitHub Actions OIDC.client-idinput (the deprecatedapp-idinput isn't supported) andid-token: writeworkflow permissions.private-key.id-token: writepermissions.Example
Beta releases don't update the
v3tag, so pin the beta release tag:README updates are deferred until the feature is generally available.