Skip to content

Commit bbcacae

Browse files
Merge pull request #50 from gabriel-samfira/fix-get-tools
Fix GetTools() for Windows and Gitea
2 parents 1b236e5 + 3c538f0 commit bbcacae

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

util/util.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -201,22 +201,22 @@ func GetTools(osType params.OSType, osArch params.OSArch, tools []params.RunnerA
201201
return params.RunnerApplicationDownload{}, fmt.Errorf("unsupported OS arch: %s", osArch)
202202
}
203203

204+
ghArch, err := ResolveToGithubArch(string(osArch))
205+
if err != nil {
206+
return params.RunnerApplicationDownload{}, fmt.Errorf("failed to convert osArch: %w", err)
207+
}
208+
ghOS, err := ResolveToGithubOSType(string(osType))
209+
if err != nil {
210+
return params.RunnerApplicationDownload{}, fmt.Errorf("failed to convert osType: %w", err)
211+
}
212+
204213
// Find tools for OS/Arch.
205214
for _, tool := range tools {
206215
if tool.GetOS() == "" || tool.GetArchitecture() == "" {
207216
continue
208217
}
209218

210-
ghArch, err := ResolveToGithubArch(string(osArch))
211-
if err != nil {
212-
continue
213-
}
214-
215-
ghOS, err := ResolveToGithubOSType(string(osType))
216-
if err != nil {
217-
continue
218-
}
219-
if tool.GetArchitecture() == ghArch && tool.GetOS() == ghOS {
219+
if (tool.GetArchitecture() == ghArch || tool.GetArchitecture() == string(osArch)) && (tool.GetOS() == ghOS || tool.GetOS() == string(osType)) {
220220
return tool, nil
221221
}
222222
}

0 commit comments

Comments
 (0)