Repository navigation
Deploy with the job's identity token when no token is given - #14
Merged
Merged
Conversation
The token input becomes optional (RFC-0005 release 5). Without it, the action runs valar auth exchange, which requests the job's GitHub identity token for the endpoint's origin (or the new audience input) and exchanges it under the project's trust policy for a one-hour token bound to the service. The token is masked and exported for the rest of the step. A given token is passed to the CLI unchanged, as before. Previews take the pull request number from GITHUB_REF, which is also the identity token's ref claim that preview policies match. scripts/deploy_test.sh runs deploy.sh against a stub CLI and checks the calls for a stored token, an exchanged one, refusals, an older CLI and previews. The README recommends a trust policy over a stored token and documents the id-token permission, deployment branch rules for environment policies, and the fallback to a stored token.
- Without a token input, the action refuses to exchange identity tokens
in pull_request_target and workflow_run runs.
- The exchanged value must be one line matching
^valar_[a-z]{2}_[0-9a-f]{64}$ before it is masked and exported.
- The README no longer relies on the fork check, which runs in the pull
request's own copy of the workflow: private repositories can send
secrets and identity tokens to fork pull requests, and what bounds an
identity token is the trust policy's pinned subject, event and ref.
Adds the checksums of the CLI 4.11.0 release assets and makes 4.11.0 the default cli-version. 4.11.0 is the first release with valar auth exchange, which the identity-token mode needs.
lnsp
marked this pull request as ready for review
November 22, 2026 21:59
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RFC-0005 release 5 lets a job deploy with its GitHub identity token instead of a stored token. This PR adds that mode.
CLI version: the default
cli-versionis now 4.11.0, the first CLI release with valar/cli#30 (valar auth exchange), andscripts/checksums.txthas its 5 assets.Behaviour
tokenis optional now. When it is given, the action passes it to the CLI unchanged, as before.token, the job needspermissions: id-token: write, which setsACTIONS_ID_TOKEN_REQUEST_URL. Without that permission, the step fails and names both options.token, the step refuses to exchange inpull_request_targetandworkflow_runruns (GITHUB_EVENT_NAME), which run with the repository's credentials on input from pull requests.valar auth exchange [--service s] [--audience a]after it has worked out the service (input, preview, or.valar.ymlthrough the CLI).audienceinput) and exchanges it attoken-exchange.VALAR_TOKENfor the rest of the step.^valar_[a-z]{2}_[0-9a-f]{64}$, so nothing else is masked or exported. An older CLI withoutauth exchangereturns no such value.GITHUB_REF(refs/pull/<n>/merge|head), the same value as the identity token'srefclaim that preview policies match. It falls back to the event's number. Closing and reopening a preview exchange first, then disable or enable.permissions: id-token: writeandvalar trust add ... --github-repo ... --environment|--branch|--pull-requests;valar trust list|remove;@actions/core'sgetIDToken(audience)uses; there is no Node step.Before merging
cli-versionolder than 4.11.0, the identity-token mode fails with the "needs a Valar CLI with 'valar auth exchange'" error; the stored-token mode is unchanged.[API.OIDC]set on the installation.scripts/deploy_test.shis new and not yet run in CI. CI's existing shellcheck step covers it (scripts/*.sh). Running it inci.ymlneeds a workflow change, left to a separate PR.Test steps
bash scripts/deploy_test.sh, which checks:build pushandservice url;audienceinput;pull_request_targetandworkflow_runwithout a token (refused), andworkflow_runwith a token (unchanged);headref);shellcheck scripts/*.shvalar trust add --service <s> --github-repo <repo> --branch main --workflow <file>, run the workflow withid-token: writeand notoken, and check the deploy and the URL;