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

🐛 check github/codeql-action releases/v3 branch explicitly. #608

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
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
17 changes: 10 additions & 7 deletions app/server/verify_workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,15 +265,18 @@ func (g *githubVerifier) contains(owner, repo, hash string) (bool, error) {
}

switch {
// github/codeql-action has commits from their v1 and v2 release branch that don't show up in the default branch
// github/codeql-action has commits from their release branches that don't show up in the default branch
// this isn't the best approach for now, but theres no universal "does this commit belong to this repo" call
case owner == "github" && repo == "codeql-action":
contains, err = g.branchContains("releases/v2", owner, repo, hash)
if err != nil {
return false, err
}
if !contains {
contains, err = g.branchContains("releases/v1", owner, repo, hash)
releaseBranches := []string{"releases/v3", "releases/v2", "releases/v1"}
for _, branch := range releaseBranches {
contains, err = g.branchContains(branch, owner, repo, hash)
if err != nil {
return false, err
}
if contains {
return true, nil
}
}

// add fallback lookup for actions/upload-artifact v3/node20 branch
Expand Down
2 changes: 2 additions & 0 deletions app/server/verify_workflow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ func Test_githubVerifier_contains_codeql_v1(t *testing.T) {
responsePaths: map[string]string{
"codeql-action": "./testdata/api/github/repository.json", // api call which finds the default branch
"main...somehash": "./testdata/api/github/divergent.json", // doesnt belong to default branch
"v3...somehash": "./testdata/api/github/divergent.json", // doesnt belong to releases/v3 branch
"v2...somehash": "./testdata/api/github/divergent.json", // doesnt belong to releases/v2 branch
"v1...somehash": "./testdata/api/github/containsCommit.json", // belongs to releases/v1 branch
},
Expand All @@ -148,6 +149,7 @@ func Test_githubVerifier_contains_codeql_v2(t *testing.T) {
responsePaths: map[string]string{
"codeql-action": "./testdata/api/github/repository.json", // api call which finds the default branch
"main...somehash": "./testdata/api/github/divergent.json", // doesnt belong to default branch
"v3...somehash": "./testdata/api/github/divergent.json", // doesnt belong to releases/v3 branch either
"v2...somehash": "./testdata/api/github/containsCommit.json", // belongs to releases/v2 branch
},
},
Expand Down
Loading