Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cask: fewer GitHub Actions warnings. #19009

Merged
merged 1 commit into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Library/Homebrew/cask/download.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ def basename

sig { override.params(filename: Pathname).void }
def verify_download_integrity(filename)
if @cask.sha256 == :no_check
official_cask_tap = @cask.tap&.official?
if @cask.sha256 == :no_check && !official_cask_tap
opoo "No checksum defined for cask '#{@cask}', skipping verification."
return
end
Expand Down
3 changes: 2 additions & 1 deletion Library/Homebrew/cask/installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ def install
backup if force? && @cask.staged_path.exist? && @cask.metadata_versioned_path.exist?

oh1 "Installing Cask #{Formatter.identifier(@cask)}"
opoo "macOS's Gatekeeper has been disabled for this Cask" unless quarantine?
# GitHub Actions globally disables Gatekeeper.
opoo "macOS's Gatekeeper has been disabled for this Cask" if !quarantine? && !GitHub::Actions.env_set?
stage

@cask.config = @cask.default_config.merge(old_config)
Expand Down
13 changes: 11 additions & 2 deletions Library/Homebrew/test/cask/download_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
describe "#verify_download_integrity" do
subject(:verification) { described_class.new(cask).verify_download_integrity(downloaded_path) }

let(:cask) { instance_double(Cask::Cask, token: "cask", sha256: expected_sha256) }
let(:tap) { nil }
let(:cask) { instance_double(Cask::Cask, token: "cask", sha256: expected_sha256, tap:) }
let(:cafebabe) { "cafebabecafebabecafebabecafebabecafebabecafebabecafebabecafebabe" }
let(:deadbeef) { "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef" }
let(:computed_sha256) { cafebabe }
Expand All @@ -17,9 +18,17 @@
context "when the expected checksum is :no_check" do
let(:expected_sha256) { :no_check }

it "skips the check" do
it "warns about skipping the check" do
expect { verification }.to output(/skipping verification/).to_stderr
end

context "with an official tap" do
let(:tap) { CoreCaskTap.instance }

it "does not warn about skipping the check" do
expect { verification }.not_to output(/skipping verification/).to_stderr
end
end
end

context "when expected and computed checksums match" do
Expand Down
Loading