From cfba45fb562f8b8315f2c6440c3b9dc8f6321cc7 Mon Sep 17 00:00:00 2001 From: Sam Ford <1584702+samford@users.noreply.github.com> Date: Thu, 4 May 2023 11:17:24 -0400 Subject: [PATCH] GithubLatest: Use API URL as generated value The generated URL should reflect what we're actually checking, which is now the `/releases/latest` API URL. --- Library/Homebrew/livecheck/strategy/github_latest.rb | 3 +-- Library/Homebrew/test/livecheck/strategy/github_latest_spec.rb | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/livecheck/strategy/github_latest.rb b/Library/Homebrew/livecheck/strategy/github_latest.rb index c5f4a21b85..d616763f01 100644 --- a/Library/Homebrew/livecheck/strategy/github_latest.rb +++ b/Library/Homebrew/livecheck/strategy/github_latest.rb @@ -76,8 +76,7 @@ module Homebrew match = url.sub(/\.git$/i, "").match(URL_MATCH_REGEX) return values if match.blank? - # Example URL: `https://github.com/example/example/releases/latest` - values[:url] = "https://github.com/#{match[:username]}/#{match[:repository]}/releases/latest" + values[:url] = "https://api.github.com/repos/#{match[:username]}/#{match[:repository]}/releases/latest" values[:username] = match[:username] values[:repository] = match[:repository] diff --git a/Library/Homebrew/test/livecheck/strategy/github_latest_spec.rb b/Library/Homebrew/test/livecheck/strategy/github_latest_spec.rb index 4f95c44098..194463da91 100644 --- a/Library/Homebrew/test/livecheck/strategy/github_latest_spec.rb +++ b/Library/Homebrew/test/livecheck/strategy/github_latest_spec.rb @@ -16,8 +16,8 @@ describe Homebrew::Livecheck::Strategy::GithubLatest do let(:generated) do { + url: "https://api.github.com/repos/abc/def/releases/latest", username: "abc", - url: "https://github.com/abc/def/releases/latest", repository: "def", } end