diff --git a/src/scripts/tools/add_tools.ps1 b/src/scripts/tools/add_tools.ps1 index 3402a16d..a45362db 100644 --- a/src/scripts/tools/add_tools.ps1 +++ b/src/scripts/tools/add_tools.ps1 @@ -74,11 +74,9 @@ Function Set-ComposerAuth() { if(Test-Path env:PACKAGIST_TOKEN) { $composer_auth += '"http-basic": {"repo.packagist.com": { "username": "token", "password": "' + $env:PACKAGIST_TOKEN + '"}}' } - if(-not(Test-Path env:GITHUB_TOKEN) -and (Test-Path env:COMPOSER_TOKEN)) { - $env:GITHUB_TOKEN = $env:COMPOSER_TOKEN - } - if (Test-Path env:GITHUB_TOKEN) { - $composer_auth += '"github-oauth": {"github.com": "' + $env:GITHUB_TOKEN + '"}' + $token = if ($env:COMPOSER_TOKEN) { $env:COMPOSER_TOKEN } else { $env:GITHUB_TOKEN } + if ($token) { + $composer_auth += '"github-oauth": {"github.com": "' + $token + '"}' } if($composer_auth.length) { Update-AuthJson $composer_auth diff --git a/src/scripts/tools/add_tools.sh b/src/scripts/tools/add_tools.sh index 3163cc0c..484f2233 100644 --- a/src/scripts/tools/add_tools.sh +++ b/src/scripts/tools/add_tools.sh @@ -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[@]}"