From f13210801a656fb8e4217ca4db2258bf0ba8fc19 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Sat, 10 Jun 2023 02:58:52 +0800 Subject: [PATCH] formula_auditor: handle `head_info` being `nil` This happens when CI runs on an event that isn't a pull request (e.g. push, merge_group). --- Library/Homebrew/formula_auditor.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/formula_auditor.rb b/Library/Homebrew/formula_auditor.rb index 85694e7e4b..b4250e2a0a 100644 --- a/Library/Homebrew/formula_auditor.rb +++ b/Library/Homebrew/formula_auditor.rb @@ -349,7 +349,7 @@ module Homebrew # TODO: Remove this when OpenSSL migration is complete. ignore_openssl_conflict = if (github_event_path = ENV.fetch("GITHUB_EVENT_PATH", nil)).present? event_payload = JSON.parse(File.read(github_event_path)) - head_info = event_payload.dig("pull_request", "head") + head_info = event_payload.dig("pull_request", "head").to_h # handle `nil` # We need to read the head ref from `GITHUB_EVENT_PATH` because # `git branch --show-current` returns `master` on PR branches.