Skip to content

Commit 45e4318

Browse files
nficanoclaude
andcommitted
ci: fix Packagist publish auth to use query-string credentials
The Packagist API rejects the Bearer-header auth scheme with HTTP 406 "Missing or invalid username/apiToken in request". Switch to the documented query-string form (?username=&apiToken=) and update the request body to {"repository":{"url":"..."}} as the API expects. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent ca13b63 commit 45e4318

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

.github/workflows/publish.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,10 @@ jobs:
8282
exit 1
8383
fi
8484
85+
encoded_user="$(jq -rn --arg v "${PACKAGIST_USERNAME}" '$v|@uri')"
86+
encoded_token="$(jq -rn --arg v "${PACKAGIST_TOKEN}" '$v|@uri')"
8587
curl --fail-with-body -sS \
8688
-X POST \
8789
-H 'Content-Type: application/json' \
88-
-H "Authorization: Bearer ${PACKAGIST_USERNAME}:${PACKAGIST_TOKEN}" \
89-
"${endpoint}" \
90-
-d "{\"repository\":\"${REPOSITORY_URL}\"}"
90+
"${endpoint}?username=${encoded_user}&apiToken=${encoded_token}" \
91+
-d "{\"repository\":{\"url\":\"${REPOSITORY_URL}\"}}"

0 commit comments

Comments
 (0)