File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111 workflows : [Release on merge]
1212 types : [completed]
1313
14- permissions :
15- contents : read
16- id-token : write
17-
1814jobs :
1915 publish :
2016 if : >-
2117 github.event_name != 'workflow_run' ||
2218 github.event.workflow_run.conclusion == 'success'
2319 runs-on : ubuntu-latest
20+ # Explicit job permissions: org default token scopes must not block OIDC.
21+ permissions :
22+ contents : read
23+ id-token : write
2424 steps :
2525 - uses : actions/checkout@v6
2626 with :
8787 if : steps.gate.outputs.publish == 'true'
8888 run : npm install --ignore-scripts --no-package-lock
8989
90+ # If NODE_AUTH_TOKEN / NPM_TOKEN are set to empty or a placeholder (repo/org Variables,
91+ # or setup-node + registry-url), npm prefers them over OIDC and fails with ENEEDAUTH.
9092 - name : Publish to npm
9193 if : steps.gate.outputs.publish == 'true'
92- run : npm publish --access public --provenance
94+ run : |
95+ set -euo pipefail
96+ if [[ -z "${ACTIONS_ID_TOKEN_REQUEST_URL:-}" || -z "${ACTIONS_ID_TOKEN_REQUEST_TOKEN:-}" ]]; then
97+ echo "::error::GitHub OIDC is unavailable (missing ACTIONS_ID_TOKEN_*). Check job permissions id-token: write and repo Settings → Actions → Workflow permissions."
98+ exit 1
99+ fi
100+ unset NODE_AUTH_TOKEN NPM_TOKEN
101+ npm publish --access public --provenance
93102
94103 - name : Publish to JSR
95104 if : steps.gate.outputs.publish == 'true'
You can’t perform that action at this time.
0 commit comments