diff --git a/Library/Homebrew/utils/github.rb b/Library/Homebrew/utils/github.rb index 0c813ac366..8ac404d448 100644 --- a/Library/Homebrew/utils/github.rb +++ b/Library/Homebrew/utils/github.rb @@ -163,7 +163,8 @@ module GitHub # This is a no-op if the user is opting out of using the GitHub API. return block_given? ? yield({}) : {} if ENV["HOMEBREW_NO_GITHUB_API"] - args = ["--header", "application/vnd.github.v3+json", "--write-out", "\n%{http_code}"] + args = ["--header", "Accept: application/vnd.github.v3+json", "--write-out", "\n%{http_code}"] + args += ["--header", "Accept: application/vnd.github.antiope-preview+json"] token, username = api_credentials case api_credentials_type @@ -261,6 +262,15 @@ module GitHub end end + def check_runs(repo: nil, commit: nil, pr: nil) + if pr + repo = pr.fetch("base").fetch("repo").fetch("full_name") + commit = pr.fetch("head").fetch("sha") + end + + open_api(url_to("repos", repo, "commits", commit, "check-runs")) + end + def search_issues(query, **qualifiers) search("issues", query, **qualifiers) end