Skip to content

Commit 2e7ad4e

Browse files
Testclaude
andcommitted
ci: bypass setup-php auto-written composer auth (workaround for malformed token)
Recent CI runs hit "Your github oauth token for github.com contains invalid characters" intermittently — once on PHP 8.5/master (eb53350), once on PHP 7.4 on the refactor branch (5843b6e). Same error, different PHP version each time. Root cause: shivammathur/setup-php@v2 writes ~/.composer/auth.json with $GITHUB_TOKEN by default. GitHub Actions has been occasionally returning that token with embedded newlines (visible in the log as multiline `***` mask), which composer 2.10 rejects with the error above. Fix: in the Linux install step, drop the auto-written auth.json and set COMPOSER_AUTH='{}' so composer runs without a token. Our deps are all public (packagist) so no auth is needed. Windows uses the system composer with a different env so it has not hit this; leaving it untouched. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 5843b6e commit 2e7ad4e

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,15 @@ jobs:
8080
8181
- name: Install dependencies (Linux)
8282
if: runner.os == 'Linux'
83+
env:
84+
# setup-php@v2 writes ~/.composer/auth.json with $GITHUB_TOKEN by
85+
# default. Recently that token has been occasionally malformed
86+
# (newlines embedded), causing composer to fail with "github oauth
87+
# token contains invalid characters". Our deps are all public, so
88+
# we drop the auto-written auth before install.
89+
COMPOSER_AUTH: '{}'
8390
run: |
91+
rm -f ~/.composer/auth.json ~/.config/composer/auth.json
8492
chmod -R +x tools/*
8593
tools/composer install --prefer-dist --no-progress
8694

0 commit comments

Comments
 (0)