mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-26 05:23:03 +07:00
Add support to configure GitHub OAuth token in composer
This commit is contained in:
parent
6c93dbd391
commit
a2b261d79a
@ -108,6 +108,9 @@ add_tool() {
|
|||||||
sudo chmod a+x "$tool_path"
|
sudo chmod a+x "$tool_path"
|
||||||
if [ "$tool" = "composer" ]; then
|
if [ "$tool" = "composer" ]; then
|
||||||
composer -q global config process-timeout 0
|
composer -q global config process-timeout 0
|
||||||
|
if [ -n "$COMPOSER_TOKEN" ]; then
|
||||||
|
composer -q global config github-oauth.github.com "$COMPOSER_TOKEN"
|
||||||
|
fi
|
||||||
elif [ "$tool" = "phive" ]; then
|
elif [ "$tool" = "phive" ]; then
|
||||||
add_extension curl "sudo pecl install -f curl" extension >/dev/null 2>&1
|
add_extension curl "sudo pecl install -f curl" extension >/dev/null 2>&1
|
||||||
add_extension mbstring "sudo pecl install -f mbstring" extension >/dev/null 2>&1
|
add_extension mbstring "sudo pecl install -f mbstring" extension >/dev/null 2>&1
|
||||||
|
@ -181,6 +181,9 @@ add_tool() {
|
|||||||
sudo chmod a+x "$tool_path"
|
sudo chmod a+x "$tool_path"
|
||||||
if [ "$tool" = "composer" ]; then
|
if [ "$tool" = "composer" ]; then
|
||||||
composer -q global config process-timeout 0
|
composer -q global config process-timeout 0
|
||||||
|
if [ -n "$COMPOSER_TOKEN" ]; then
|
||||||
|
composer -q global config github-oauth.github.com "$COMPOSER_TOKEN"
|
||||||
|
fi
|
||||||
elif [ "$tool" = "cs2pr" ]; then
|
elif [ "$tool" = "cs2pr" ]; then
|
||||||
sudo sed -i 's/\r$//; s/exit(9)/exit(0)/' "$tool_path"
|
sudo sed -i 's/\r$//; s/exit(9)/exit(0)/' "$tool_path"
|
||||||
elif [ "$tool" = "phive" ]; then
|
elif [ "$tool" = "phive" ]; then
|
||||||
|
@ -136,6 +136,9 @@ Function Add-Tool() {
|
|||||||
(Get-Content $php_dir/cs2pr).replace('exit(9)', 'exit(0)') | Set-Content $php_dir/cs2pr
|
(Get-Content $php_dir/cs2pr).replace('exit(9)', 'exit(0)') | Set-Content $php_dir/cs2pr
|
||||||
} elseif($tool -eq "composer") {
|
} elseif($tool -eq "composer") {
|
||||||
composer -q global config process-timeout 0
|
composer -q global config process-timeout 0
|
||||||
|
if (Test-Path env:COMPOSER_TOKEN) {
|
||||||
|
composer -q global config github-oauth.github.com $env:COMPOSER_TOKEN
|
||||||
|
}
|
||||||
} elseif($tool -eq "wp-cli") {
|
} elseif($tool -eq "wp-cli") {
|
||||||
Copy-Item $php_dir\wp-cli.bat -Destination $php_dir\wp.bat
|
Copy-Item $php_dir\wp-cli.bat -Destination $php_dir\wp.bat
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user