From 164cb429a4f9b5bc8405b278e6a3fa9073f0d1b0 Mon Sep 17 00:00:00 2001 From: Abe Tomoaki Date: Fri, 5 Jul 2024 18:46:48 +0900 Subject: [PATCH] packages/windows: Use Octokit's artifact_download_url (#1814) Fixed the error: ``` (Octokit::BadRequest) InvalidAuthenticationInfoAuthentication information is not given in the correct format. Check the value of Authorization header. RequestId:xxx Time:2024-07-05T06:20:29.6447183Z ``` This is caused by `Authorization` header is reused in redirect request. We can avoid this problem by using a new HTTP client without no `Authorization` header. --- packages/windows/download_github_actions_artifact.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/windows/download_github_actions_artifact.rb b/packages/windows/download_github_actions_artifact.rb index f8354bad99..5cbcb6b2ea 100755 --- a/packages/windows/download_github_actions_artifact.rb +++ b/packages/windows/download_github_actions_artifact.rb @@ -1,6 +1,7 @@ #!/usr/bin/env ruby require "fileutils" +require "open-uri" require "octokit" @@ -33,7 +34,10 @@ FileUtils.mkdir_p(output_directory) puts("Downloading #{name}...") File.open("#{output_directory}/#{name}.zip", "wb") do |output| - output.print(client.get("/repos/groonga/groonga/actions/artifacts/#{id}/zip")) + uri = URI.parse(client.artifact_download_url('groonga/groonga', id)) + uri.open do |input| + IO.copy_stream(input, output) + end end downloaded = true break unless target_type == "all"