GitHubArtifactDownloadStrategy: fix initialize signature
This commit is contained in:
parent
ee6ef00a73
commit
9260bd97e8
@ -637,9 +637,10 @@ end
|
|||||||
#
|
#
|
||||||
# @api private
|
# @api private
|
||||||
class GitHubArtifactDownloadStrategy < AbstractFileDownloadStrategy
|
class GitHubArtifactDownloadStrategy < AbstractFileDownloadStrategy
|
||||||
def initialize
|
def initialize(url, artifact_id, token:)
|
||||||
super
|
super(url, "artifact", artifact_id)
|
||||||
@cache = HOMEBREW_CACHE/"gh-actions-artifact"
|
@cache = HOMEBREW_CACHE/"gh-actions-artifact"
|
||||||
|
@token = token
|
||||||
end
|
end
|
||||||
|
|
||||||
def fetch(timeout: nil)
|
def fetch(timeout: nil)
|
||||||
@ -649,8 +650,8 @@ class GitHubArtifactDownloadStrategy < AbstractFileDownloadStrategy
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
curl "--location", "--create-dirs", "--output", temporary_path, url,
|
curl "--location", "--create-dirs", "--output", temporary_path, url,
|
||||||
*meta.fetch(:curl_args, []),
|
"--header", "Authorization: token #{@token}",
|
||||||
secrets: meta.fetch(:secrets, []),
|
secrets: [@token],
|
||||||
timeout: timeout
|
timeout: timeout
|
||||||
rescue ErrorDuringExecution
|
rescue ErrorDuringExecution
|
||||||
raise CurlDownloadStrategyError, url
|
raise CurlDownloadStrategyError, url
|
||||||
|
|||||||
@ -383,18 +383,11 @@ module GitHub
|
|||||||
odie "Credentials must be set to access the Artifacts API" if API.credentials_type == :none
|
odie "Credentials must be set to access the Artifacts API" if API.credentials_type == :none
|
||||||
|
|
||||||
token = API.credentials
|
token = API.credentials
|
||||||
curl_args = ["--header", "Authorization: token #{token}"]
|
|
||||||
|
|
||||||
# Download the artifact as a zip file and unpack it into `dir`. This is
|
# 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
|
# preferred over system `curl` and `tar` as this leverages the Homebrew
|
||||||
# cache to avoid repeated downloads of (possibly large) bottles.
|
# cache to avoid repeated downloads of (possibly large) bottles.
|
||||||
downloader = GitHubArtifactDownloadStrategy.new(
|
downloader = GitHubArtifactDownloadStrategy.new(url, artifact_id, token: token)
|
||||||
url,
|
|
||||||
"artifact",
|
|
||||||
artifact_id,
|
|
||||||
curl_args: curl_args,
|
|
||||||
secrets: [token],
|
|
||||||
)
|
|
||||||
downloader.fetch
|
downloader.fetch
|
||||||
downloader.stage
|
downloader.stage
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user