Skip to content

Commit

Permalink
Github::Check
Browse files Browse the repository at this point in the history
May receive a null object when searching for all check runs referring to Pull Request.

Signed-off-by: Rodrigo Nardi <[email protected]>
  • Loading branch information
RodrigoMNardi committed Jun 22, 2024
1 parent 46437e7 commit 954a613
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/github/check.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,17 @@ def get_check_run(check_ref)
def fetch_check_runs
return [] if @check_suite.nil?

@app
check_runs =
@app
.check_runs_for_ref(
@check_suite.pull_request.repository,
@check_suite.pull_request.branch_name,
accept: Octokit::Preview::PREVIEW_TYPES[:checks]
)
.to_h[:check_runs]
.map do |check_run|
).to_h[:check_runs]

return [] if check_runs.nil?

check_runs.map do |check_run|
check_run[:id]
end
rescue Octokit::UnprocessableEntity => e
Expand Down

0 comments on commit 954a613

Please sign in to comment.