From acb9ff294cd330698a20013055630bba19a26a7c Mon Sep 17 00:00:00 2001 From: Rob Bos Date: Sun, 30 Jul 2023 12:15:53 +0200 Subject: [PATCH 1/3] Add extra error handling for certain repos --- main.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.go b/main.go index ddc0ef1..70f2598 100644 --- a/main.go +++ b/main.go @@ -170,6 +170,9 @@ func main() { log.Printf("Listing workflow runs for: %s", repo.GetFullName()) if orgName != "" { runs, res, err = client.Actions.ListRepositoryWorkflowRuns(ctx, orgName, repo.GetName(), opts) + if err != nil { + log.Printf("Error getting the workflow runs for: %s", repo.GetFullName()) + } } if userName != "" { realOwner := userName @@ -178,6 +181,9 @@ func main() { realOwner = *repo.Owner.Login } runs, res, err = client.Actions.ListRepositoryWorkflowRuns(ctx, realOwner, repo.GetName(), opts) + if err != nil { + log.Printf("Error getting the workflow runs for: %s", repo.GetFullName()) + } } if _, ok := repoSummary[repo.GetFullName()]; !ok { From 38233624050a209f0cbdaf153bef35e77e0c5045 Mon Sep 17 00:00:00 2001 From: Rob Bos Date: Sun, 30 Jul 2023 12:19:53 +0200 Subject: [PATCH 2/3] Reset error to prevent stopping the run --- main.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main.go b/main.go index 70f2598..9d3bd14 100644 --- a/main.go +++ b/main.go @@ -172,6 +172,8 @@ func main() { runs, res, err = client.Actions.ListRepositoryWorkflowRuns(ctx, orgName, repo.GetName(), opts) if err != nil { log.Printf("Error getting the workflow runs for: %s", repo.GetFullName()) + // reset error to prevent stopping the run + err = nil } } if userName != "" { @@ -183,6 +185,8 @@ func main() { runs, res, err = client.Actions.ListRepositoryWorkflowRuns(ctx, realOwner, repo.GetName(), opts) if err != nil { log.Printf("Error getting the workflow runs for: %s", repo.GetFullName()) + // reset error to prevent stopping the run + err = nil } } From db50b380df3f7960e86bd76684fb366506e92a5b Mon Sep 17 00:00:00 2001 From: Rob Bos Date: Sun, 30 Jul 2023 12:26:39 +0200 Subject: [PATCH 3/3] Prevent issues when there are no results Signed-off-by: GitHub --- main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 9d3bd14..89c83ea 100644 --- a/main.go +++ b/main.go @@ -202,7 +202,9 @@ func main() { log.Fatal(err) } - workflowRuns = append(workflowRuns, runs.WorkflowRuns...) + if runs != nil { + workflowRuns = append(workflowRuns, runs.WorkflowRuns...) + } if len(workflowRuns) == 0 { break