Add GitHub::check_runs.

This commit is contained in:
Markus Reiter 2019-09-13 22:30:03 +02:00
parent f815d808f8
commit 31f15acc01

View File

@ -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