utils/github: avoid returning artifacts with the same name
This commit is contained in:
parent
135db8c559
commit
9ad60fe437
@ -357,9 +357,11 @@ module GitHub
|
||||
run_id = check_suite.last["workflowRun"]["databaseId"]
|
||||
artifacts = API.open_rest("#{API_URL}/repos/#{user}/#{repo}/actions/runs/#{run_id}/artifacts", scopes:)
|
||||
|
||||
matching_artifacts = artifacts["artifacts"].select do |art|
|
||||
File.fnmatch?(artifact_pattern, art["name"], File::FNM_EXTGLOB)
|
||||
end
|
||||
matching_artifacts =
|
||||
artifacts["artifacts"]
|
||||
.group_by { |art| art["name"] }
|
||||
.select { |name| File.fnmatch?(artifact_pattern, name, File::FNM_EXTGLOB) }
|
||||
.map { |_, arts| arts.last }
|
||||
|
||||
if matching_artifacts.empty?
|
||||
raise API::Error, <<~EOS
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user