From 954a613893bcb23546db83638d0daf3fc4664fdb Mon Sep 17 00:00:00 2001 From: Rodrigo Nardi Date: Fri, 21 Jun 2024 21:45:55 -0300 Subject: [PATCH] Github::Check May receive a null object when searching for all check runs referring to Pull Request. Signed-off-by: Rodrigo Nardi --- lib/github/check.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/github/check.rb b/lib/github/check.rb index a09fc62..ec7528c 100644 --- a/lib/github/check.rb +++ b/lib/github/check.rb @@ -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