Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent errors in the run for certain repos #12

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@ 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 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is a good fix.

You need to look at the specific error and HTTP code and determine if the problem is due to actions being disabled on the repo or something else, and if it's something else, it must continue to fail.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested this on repos which have actions disabled and get no errors.

Can you share the exact console output and how to reproduce it?

log.Printf("Error getting the workflow runs for: %s", repo.GetFullName())
// reset error to prevent stopping the run
err = nil
}
}
if userName != "" {
realOwner := userName
Expand All @@ -178,6 +183,11 @@ 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())
// reset error to prevent stopping the run
err = nil
}
}

if _, ok := repoSummary[repo.GetFullName()]; !ok {
Expand All @@ -192,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
Expand Down