audit: Supress pre-release audits for known pre-release formulae

- This safelists one formula that has only ever shipped pre-releases,
  from before we had the GitHub pre-release audit. So it won't fail CI
  and cause maintainers more work to determine if it's always been that
  way, or if it's new. Then, we don't have to keep comments at the top
  of files to say so for the next contributors.
- We should check this list from time to time to make sure that the
  formulae here have graduated to actual releases and we can remove
  them.
This commit is contained in:
Issy Long 2020-06-12 15:51:43 +01:00
parent ddf20bdc09
commit 7ad7834b15
No known key found for this signature in database
GPG Key ID: 8247C390DADC67D4

View File

@ -597,6 +597,8 @@ module Homebrew
"libepoxy" => "1.5",
}.freeze
GITHUB_PRERELEASE_ALLOWLIST = %w[cake].freeze
# version_prefix = stable_version_string.sub(/\d+$/, "")
# version_prefix = stable_version_string.split(".")[0..1].join(".")
@ -705,8 +707,11 @@ module Homebrew
begin
if @online && (release = GitHub.open_api("#{GitHub::API_URL}/repos/#{owner}/#{repo}/releases/tags/#{tag}"))
problem "#{tag} is a GitHub prerelease" if release["prerelease"]
problem "#{tag} is a GitHub draft" if release["draft"]
if release["prerelease"] && !GITHUB_PRERELEASE_ALLOWLIST.include?(formula.name)
problem "#{tag} is a GitHub prerelease"
elsif release["draft"]
problem "#{tag} is a GitHub draft"
end
end
rescue GitHub::HTTPNotFoundError
# No-op if we can't find the release.