From 2c1facc1941cd4e1520b9514e0ded090dea501a6 Mon Sep 17 00:00:00 2001 From: ParthaI Date: Tue, 2 Apr 2024 13:19:27 +0530 Subject: [PATCH] Fixed error querying github_workflow for repository that contains dynamic workflows Closes #410 --- github/table_github_workflow.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/github/table_github_workflow.go b/github/table_github_workflow.go index 8d578bf..de661d5 100644 --- a/github/table_github_workflow.go +++ b/github/table_github_workflow.go @@ -130,7 +130,10 @@ func GitHubWorkflowFileContent(ctx context.Context, d *plugin.QueryData, h *plug content, _, _, err := client.Repositories.GetContents(ctx, owner, repo, *workflow.Path, &github.RepositoryContentGetOptions{Ref: defaultBranch}) if err != nil { // the workflow object exists, but the file is deleted - if strings.Contains(err.Error(), "404 Not Found") { + // The API throws "404 No commit found" error if there is any dynamic workflow file generated by GitHub action. + // https://github.com/nextstrain/status/issues/6 + // https://github.com/nextstrain/status/pull/7/commits/160eb950235ae81d3d37a990a0715ed815cd7fc9 + if strings.Contains(err.Error(), "404 Not Found") || strings.Contains(err.Error(), "404 No commit found") { return nil, nil } return nil, err