Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,31 @@ jobs:
ref: ${{ fromJson(steps.get_pull_request_ref.outputs.data).head.ref }}
- uses: pnpm/setup@v2

# Snapshot publishes fail with E404 while push-triggered releases succeed.
# `changeset publish` hides pnpm's "Skipped OIDC" warning, so this step runs
# the same OIDC token exchange pnpm does and prints npm's response.
# It never prints a token and never fails the job.
- name: Diagnose npm OIDC exchange
continue-on-error: true
run: |
id_token=$(curl -sS -H "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
"$ACTIONS_ID_TOKEN_REQUEST_URL&audience=npm:registry.npmjs.org" | jq -r '.value')
echo "::add-mask::$id_token"

payload=$(echo "$id_token" | cut -d. -f2 | tr '_-' '/+')
while (( ${#payload} % 4 )); do payload="$payload="; done
echo "ID token claims:"
echo "$payload" | base64 -d | jq '{iss, aud, sub, repository, event_name, ref, workflow_ref, job_workflow_ref, environment}'

response_file=$(mktemp)
status=$(curl -sS -o "$response_file" -w '%{http_code}' -X POST \
-H "Authorization: Bearer $id_token" -H 'Accept: application/json' -H 'Content-Length: 0' \
'https://registry.npmjs.org/-/npm/v1/oidc/token/exchange/package/@eddeee888%2fgcg-server-config')
echo "::add-mask::$(jq -r '.token // empty' "$response_file")"
echo "Exchange status: $status"
jq 'del(.token)' "$response_file" || true
rm -f "$response_file"

- name: Deploy snapshot
run: |
pnpm changeset version --snapshot $RELEASE_TAG
Expand Down