Skip to content

Commit

Permalink
🧹 return nil when no branch protection found
Browse files Browse the repository at this point in the history
  • Loading branch information
vjeffrey committed Sep 13, 2023
1 parent 886f879 commit 517017a
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions providers/github/resources/github_repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -471,22 +471,7 @@ func (g *mqlGithubBranch) protectionRules() (*mqlGithubBranchprotection, error)
if err != nil {
// NOTE it is possible that the branch does not have any protection rules, therefore we don't return an error
if strings.Contains(err.Error(), "Not Found") {
res, err := CreateResource(g.MqlRuntime, "github.branchprotection", map[string]*llx.RawData{
"id": llx.StringData(repoName + "/" + branchName),
"requiredStatusChecks": llx.MapData(map[string]interface{}{}, types.Any),
"requiredPullRequestReviews": llx.MapData(map[string]interface{}{}, types.Any),
"enforceAdmins": llx.MapData(map[string]interface{}{}, types.Any),
"restrictions": llx.MapData(map[string]interface{}{}, types.Any),
"requireLinearHistory": llx.MapData(map[string]interface{}{}, types.Any),
"allowForcePushes": llx.MapData(map[string]interface{}{}, types.Any),
"allowDeletions": llx.MapData(map[string]interface{}{}, types.Any),
"requiredConversationResolution": llx.MapData(map[string]interface{}{}, types.Any),
"requiredSignatures": llx.BoolData(false),
})
if err != nil {
return nil, err
}
return res.(*mqlGithubBranchprotection), nil
return nil, nil
}
// TODO: figure out if the client has the permission to fetch the protection rules
return nil, err
Expand Down

0 comments on commit 517017a

Please sign in to comment.