Skip to content

Commit

Permalink
GithubLatest: Use curl options in request
Browse files Browse the repository at this point in the history
We can't pass curl options to `GitHub#get_latest_release`, so we have
to switch to an `#open_rest` call in `GithubLatest`. The former method
simply creates the API URL from a username and repository before
calling `#open_rest`. We already generate the same URL, so we're not
losing anything with this switch.

This maintains the existing API request but we're able to properly
use `DEFAULT_CURL_OPTIONS`, which notably ensures that the curl
command isn't printed in the middle of carefully-crafted `brew
livecheck --debug` output, among other things.
  • Loading branch information
samford committed May 10, 2023
1 parent cffa013 commit 7502871
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Library/Homebrew/livecheck/strategy/github_latest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,11 @@ def self.find_versions(url:, regex: DEFAULT_REGEX, **_unused, &block)

match_data[:url] = generated[:url]

release = GitHub.get_latest_release(generated[:username], generated[:repository])
release = GitHub::API.open_rest(
generated[:url],
request_method: :GET,
**Strategy::DEFAULT_CURL_OPTIONS
)
versions_from_content(release, regex, &block).each do |match_text|
match_data[:matches][match_text] = Version.new(match_text)
end
Expand Down

0 comments on commit 7502871

Please sign in to comment.