Merge pull request #14918 from SMillerDev/master

bump-formula-pr: add release notes if found
This commit is contained in:
Mike McQuaid 2023-03-08 14:02:36 +00:00 committed by GitHub
commit 8d71aa02dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -346,6 +346,28 @@ module Homebrew
EOS
end
if new_url =~ %r{^https://github\.com/([\w-]+)/([\w-]+)/archive/refs/tags/(v?[.0-9]+)\.tar\.}
owner = Regexp.last_match(1)
repo = Regexp.last_match(2)
tag = Regexp.last_match(3)
github_release_data = begin
GitHub::API.open_rest("#{GitHub::API_URL}/repos/#{owner}/#{repo}/releases/tags/#{tag}")
rescue GitHub::API::HTTPNotFoundError
# If this is a 404: we can't do anything.
nil
end
if github_release_data.present?
pre = "pre" if github_release_data["prerelease"].present?
pr_message += <<~XML
<details>
<summary>#{pre}release notes</summary>
#{github_release_data["body"]}
</details>
XML
end
end
pr_info = {
sourcefile_path: formula.path,
old_contents: old_contents,