List downloaded artifacts

This commit is contained in:
Alvaro Muñoz
2023-10-26 12:04:23 +02:00
parent 4aa9205a6f
commit 2c13e0f578

View File

@@ -551,7 +551,9 @@ func downloadArtifact(url string, task models.DownloadTask) error {
log.Fatal(err) log.Fatal(err)
} }
downloadedFiles := []string{}
for _, zf := range zipReader.File { for _, zf := range zipReader.File {
if zf.Name != "results.sarif" && zf.Name != "results.bqrs" { if zf.Name != "results.sarif" && zf.Name != "results.bqrs" {
continue continue
} }
@@ -581,9 +583,15 @@ func downloadArtifact(url string, task models.DownloadTask) error {
if err != nil { if err != nil {
return err return err
} }
downloadedFiles = append(downloadedFiles, resultPath)
}
if len(downloadedFiles) == 0 {
return errors.New("No results files found in artifact")
} else {
fmt.Println("Downloaded", downloadedFiles)
return nil return nil
} }
return errors.New("No results.sarif file found in artifact")
} }
func DownloadResults(task models.DownloadTask) error { func DownloadResults(task models.DownloadTask) error {