Skip to content

Commit

Permalink
Merge pull request #7231 from hyuraku/audit_github-prerelease_or_not
Browse files Browse the repository at this point in the history
audit whether GitHub prerelease or not
  • Loading branch information
MikeMcQuaid authored Apr 13, 2020
2 parents c5c161a + afa5713 commit 2200b1e
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion Library/Homebrew/dev-cmd/audit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ def audit_specs
.split(".", 3)
.map(&:to_i)

case stable.url
case (url = stable.url)
when /[\d\._-](alpha|beta|rc\d)/
matched = Regexp.last_match(1)
version_prefix = stable_version_string.sub(/\d+$/, "")
Expand All @@ -803,6 +803,24 @@ def audit_specs
return if stable_url_minor_version.even?

problem "#{stable.version} is a development release"
when %r{^https://github.com/([\w-]+)/([\w-]+)/}
owner = Regexp.last_match(1)
repo = Regexp.last_match(2)
tag = url.match(%r{^https://github\.com/[\w-]+/[\w-]+/archive/([^/]+)\.(tar\.gz|zip)$})
.to_a
.second
tag ||= url.match(%r{^https://github\.com/[\w-]+/[\w-]+/releases/download/([^/]+)/})
.to_a
.second

begin
if (release = GitHub.open_api("#{GitHub::API_URL}/repos/#{owner}/#{repo}/releases/tags/#{tag}"))
problem "#{tag} is a GitHub prerelease" if release["prerelease"]
end
rescue GitHub::HTTPNotFoundError
# No-op if we can't find the release.
nil
end
end
end

Expand Down

0 comments on commit 2200b1e

Please sign in to comment.