mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
pr-pull: support globbing artifacts
Artifact actions v3 is deprecated and will soon be unavailable [^1]. This adds support for v4 by allowing `brew pr-pull` to accept a glob pattern for artifact names, like actions/download-artifact does [^2]. [^1]: https://github.blog/changelog/2024-04-16-deprecation-notice-v3-of-the-artifact-actions/ [^2]: https://github.com/actions/download-artifact/tree/v4/#usage
This commit is contained in:
parent
0df71ea6a3
commit
1a1a466e9d
@ -55,8 +55,8 @@ module Homebrew
|
||||
flag "--message=",
|
||||
depends_on: "--autosquash",
|
||||
description: "Message to include when autosquashing revision bumps, deletions and rebuilds."
|
||||
flag "--artifact=",
|
||||
description: "Download artifacts with the specified name (default: `bottles`)."
|
||||
flag "--artifact-pattern=", "--artifact=",
|
||||
description: "Download artifacts with the specified pattern (default: `bottles{,-*}`)."
|
||||
flag "--tap=",
|
||||
description: "Target tap repository (default: `homebrew/core`)."
|
||||
flag "--root-url=",
|
||||
@ -81,7 +81,7 @@ module Homebrew
|
||||
ensure_executable!("unzip", reason: "extracting CI artifacts")
|
||||
|
||||
workflows = args.workflows.presence || ["tests.yml"]
|
||||
artifact = args.artifact || "bottles"
|
||||
artifact_pattern = args.artifact_pattern || "bottles{,-*}"
|
||||
tap = Tap.fetch(args.tap || CoreTap.instance.name)
|
||||
raise TapUnavailableError, tap.name unless tap.installed?
|
||||
|
||||
@ -143,7 +143,7 @@ module Homebrew
|
||||
|
||||
workflows.each do |workflow|
|
||||
workflow_run = GitHub.get_workflow_run(
|
||||
user, repo, pr, workflow_id: workflow, artifact_name: artifact
|
||||
user, repo, pr, workflow_id: workflow, artifact_pattern:
|
||||
)
|
||||
if args.ignore_missing_artifacts.present? &&
|
||||
T.must(args.ignore_missing_artifacts).include?(workflow) &&
|
||||
@ -155,8 +155,10 @@ module Homebrew
|
||||
end
|
||||
|
||||
ohai "Downloading bottles for workflow: #{workflow}"
|
||||
url = GitHub.get_artifact_url(workflow_run)
|
||||
GitHub.download_artifact(url, pr)
|
||||
urls = GitHub.get_artifact_urls(workflow_run)
|
||||
urls.each do |url|
|
||||
GitHub.download_artifact(url, pr)
|
||||
end
|
||||
end
|
||||
|
||||
next if args.no_upload?
|
||||
|
@ -8,6 +8,9 @@ class Homebrew::CLI::Args
|
||||
sig { returns(T.nilable(String)) }
|
||||
def artifact; end
|
||||
|
||||
sig { returns(T.nilable(String)) }
|
||||
def artifact_pattern; end
|
||||
|
||||
sig { returns(T::Boolean) }
|
||||
def autosquash?; end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user