Merge pull request #15539 from carlocab/audit-fix

formula_auditor: handle `head_info` being `nil`
This commit is contained in:
Carlo Cabrera 2023-06-10 03:18:36 +08:00 committed by GitHub
commit ce96e0aafa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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