Override GITHUB_TOKEN if COMPOSER_TOKEN is set

This commit is contained in:
Shivam Mathur
2025-07-30 22:30:05 +05:30
parent ccf2c627fe
commit dcec1cf0b4
2 changed files with 5 additions and 7 deletions

View File

@ -78,8 +78,8 @@ set_composer_auth() {
if [ -n "$PACKAGIST_TOKEN" ]; then
composer_auth+=( '"http-basic": {"repo.packagist.com": { "username": "token", "password": "'"$PACKAGIST_TOKEN"'"}}' )
fi
if [ -n "${GITHUB_TOKEN:-$COMPOSER_TOKEN}" ]; then
composer_auth+=( '"github-oauth": {"github.com": "'"${GITHUB_TOKEN:-$COMPOSER_TOKEN}"'"}' )
if [ -n "${COMPOSER_TOKEN:-$GITHUB_TOKEN}" ]; then
composer_auth+=( '"github-oauth": {"github.com": "'"${COMPOSER_TOKEN:-$GITHUB_TOKEN}"'"}' )
fi
if ((${#composer_auth[@]})); then
update_auth_json "${composer_auth[@]}"