diff --git a/Library/Homebrew/dev-cmd/pr-pull.rb b/Library/Homebrew/dev-cmd/pr-pull.rb index 69d65eb711..99991c34c8 100644 --- a/Library/Homebrew/dev-cmd/pr-pull.rb +++ b/Library/Homebrew/dev-cmd/pr-pull.rb @@ -482,7 +482,7 @@ module Homebrew ohai "Downloading bottles for workflow: #{workflow}" url = GitHub.get_artifact_url(workflow_run) - GitHub.download_artifact(url, pr, dir) + GitHub.download_artifact(url, pr) end next if args.no_upload? diff --git a/Library/Homebrew/utils/github.rb b/Library/Homebrew/utils/github.rb index 21145f00fd..eb3ec64543 100644 --- a/Library/Homebrew/utils/github.rb +++ b/Library/Homebrew/utils/github.rb @@ -372,7 +372,14 @@ module GitHub artifact.last["archive_download_url"] end - def self.download_artifact(url, artifact_id, dir = Pathname.pwd) + # Downloads an artifact from GitHub Actions. + # + # @param url [String] URL to download from + # @param artifact_id [String] a value that uniquely identifies the downloaded artifact + # + # @api private + sig { params(url: String, artifact_id: String).void } + def self.download_artifact(url, artifact_id) odie "Credentials must be set to access the Artifacts API" if API.credentials_type == :none token = API.credentials @@ -381,17 +388,15 @@ module GitHub # Download the artifact as a zip file and unpack it into `dir`. This is # preferred over system `curl` and `tar` as this leverages the Homebrew # cache to avoid repeated downloads of (possibly large) bottles. - FileUtils.chdir dir do - downloader = GitHubArtifactDownloadStrategy.new( - url, - "artifact", - artifact_id, - curl_args: curl_args, - secrets: [token], - ) - downloader.fetch - downloader.stage - end + downloader = GitHubArtifactDownloadStrategy.new( + url, + "artifact", + artifact_id, + curl_args: curl_args, + secrets: [token], + ) + downloader.fetch + downloader.stage end def self.public_member_usernames(org, per_page: 100)