extension-command icon indicating copy to clipboard operation
extension-command copied to clipboard

Add support GitHub releases/latest on installation

Open BogdanUngureanu opened this issue 1 year ago • 2 comments

Related to https://github.com/wp-cli/extension-command/issues/91

This PR adds support for installing plugins and themes from GitHub using the release/latest URLs.

In order to get the latest release assets, I'm proposing to use the GitHub public API to extract the latest version of the plugin/theme from GH releases. If there's no asset defined, we will fall back to the source code zip file.

~~While the implementation works right now, I haven't added support for GitHub's API request limits. Currently, after 60 requests per hour, the user is required to use an access token in order to make an API request. However, this PR doesn't expose a way to pass that token to the request.~~

UPDATE: I've introduced a new environment variable called GITHUB_TOKEN.

BogdanUngureanu avatar Nov 17 '23 09:11 BogdanUngureanu

  • Pass a new optional GitHub access token as a flag on the command.

I'd use an environment variable instead, e.g. getenv( 'GITHUB_TOKEN' )

swissspidy avatar Nov 17 '23 10:11 swissspidy

Hey @swissspidy, that's a great idea! I've updated the PR to contain the environment variable you proposed. Thanks!

BogdanUngureanu avatar Nov 18 '23 13:11 BogdanUngureanu

Closing in favor of #421

swissspidy avatar Apr 26 '24 21:04 swissspidy