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

[bug]: branch_protection - added missing App DismissalActorTypes #1896

Merged
merged 2 commits into from
Sep 27, 2023
Merged
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
9 changes: 7 additions & 2 deletions github/util_v4_branch_protection.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type ActorUser struct {

type DismissalActorTypes struct {
Actor struct {
App Actor `graphql:"... on App"`
Team Actor `graphql:"... on Team"`
User ActorUser `graphql:"... on User"`
}
Expand Down Expand Up @@ -340,7 +341,7 @@ func setDismissalActorIDs(actors []DismissalActorTypes, data BranchProtectionRes
for _, a := range actors {
IsID := false
for _, v := range data.ReviewDismissalActorIDs {
if (a.Actor.Team.ID != nil && a.Actor.Team.ID.(string) == v) || (a.Actor.User.ID != nil && a.Actor.User.ID.(string) == v) {
if (a.Actor.Team.ID != nil && a.Actor.Team.ID.(string) == v) || (a.Actor.User.ID != nil && a.Actor.User.ID.(string) == v) || (a.Actor.App.ID != nil && a.Actor.App.ID.(string) == v) {
dismissalActors = append(dismissalActors, v)
IsID = true
break
Expand All @@ -353,6 +354,10 @@ func setDismissalActorIDs(actors []DismissalActorTypes, data BranchProtectionRes
}
if a.Actor.User.Login != "" {
dismissalActors = append(dismissalActors, "/"+string(a.Actor.User.Login))
continue
}
if a.Actor.App != (Actor{}) {
dismissalActors = append(dismissalActors, a.Actor.App.ID.(string))
}
}
}
Expand Down Expand Up @@ -561,7 +566,7 @@ func getBranchProtectionID(repoID githubv4.ID, pattern string, meta interface{})
}
}

return nil, fmt.Errorf("could not find a branch protection rule with the pattern '%s'.", pattern)
return nil, fmt.Errorf("could not find a branch protection rule with the pattern '%s'", pattern)
}

func getActorIds(data []string, meta interface{}) ([]string, error) {
Expand Down