Skip to content

Commit

Permalink
packages/windows: Use Octokit's artifact_download_url (groonga#1814)
Browse files Browse the repository at this point in the history
Fixed the error:

```
<?xml version="1.0" encoding="utf-8"?> (Octokit::BadRequest)
<Error><Code>InvalidAuthenticationInfo</Code><Message>Authentication information is not given in the correct format. Check the value of Authorization header.
RequestId:xxx
Time:2024-07-05T06:20:29.6447183Z</Message></Error>
```

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.
  • Loading branch information
abetomo authored Jul 5, 2024
1 parent 5a2f2d0 commit 164cb42
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/windows/download_github_actions_artifact.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env ruby

require "fileutils"
require "open-uri"

require "octokit"

Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 164cb42

Please sign in to comment.