Add support GitHub releases/latest on installation#386
Closed
BogdanUngureanu wants to merge 2 commits intowp-cli:mainfrom
Closed
Add support GitHub releases/latest on installation#386BogdanUngureanu wants to merge 2 commits intowp-cli:mainfrom
BogdanUngureanu wants to merge 2 commits intowp-cli:mainfrom
Conversation
Member
I'd use an environment variable instead, e.g. |
Contributor
Author
|
Hey @swissspidy, that's a great idea! I've updated the PR to contain the environment variable you proposed. Thanks! |
danielbachhuber
requested changes
Dec 8, 2023
Member
danielbachhuber
left a comment
There was a problem hiding this comment.
Looks like a great start, @BogdanUngureanu ! I have a few changes to suggest.
| * | ||
| * @return string|null | ||
| */ | ||
| public function get_github_repo_from_url( $url ) { |
Member
There was a problem hiding this comment.
Suggested change
| public function get_github_repo_from_url( $url ) { | |
| public function get_github_repo_from_releases_url( $url ) { |
Should we include 'releases' in this method name to make it more specific?
|
|
||
| namespace WP_CLI; | ||
|
|
||
| final class ParseGithubUrlInput { |
Member
There was a problem hiding this comment.
Can we move the methods on this class to the existing CommandWithUpgrade class? I don't think we want to introduce it as a class others can use, etc.
| """ | ||
| Plugin installed successfully. | ||
| Success: Installed 1 of 1 plugins. | ||
| """ |
Member
There was a problem hiding this comment.
Can you include a test case for the non-happy path too?
Member
|
Closing in favor of #421 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 to #91
This PR adds support for installing plugins and themes from GitHub using the
release/latestURLs.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.