Add GITHUB_TOKEN and COMPOSER_AUTH handling. #47
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related #44 (comment)
Adds a
Package_Command::set_composer_auth_env_var()
function to set theCOMPOSER_AUTH
environment var used by Composer with the value ofGITHUB_TOKEN
if available, to avoid authorization failures, and calls it before each command. (There are undoubtedly other ways to achieve this, so other ideas might be better.)Also adds
GITHUB_TOKEN
authorization to the http requests à la wp-cli/wp-cli#4281.Also only sets the
@github-api
tag inutils/behat-tags.php
ifGITHUB_TOKEN
not available - this is only temporary as will also do the same in the source of truth versionwp-cli/wp-cli
shortly with a PR there enabling@github-api
tests on Travis.Note I temporarily added my own GITHUB_TOKEN to https://travis-ci.org/wp-cli/package-command/settings to get the tests to run, but it would probably be best if one of the maintainers added it instead.
Also changes
get_package_by_shortened_identifier()
to return thehttps
url rather than the sshgit@
version, as this is actually what is tested and seems to be the recommended protocol nowadays anyway (Which remote URL should I use?), and adapts the output checks in tests accordingly.Also tags the tests involving
schlessera/test-command
as@require-php-5.5
, as it's currently PHP 5.5.0 dependent - see wp-cli-test/test-command#1Also clarifies the mismatch test a bit.