Skip to content

Commit

Permalink
fix(branch_protection): added missing App DismissalActorTypes
Browse files Browse the repository at this point in the history
  • Loading branch information
dion-gionet committed Sep 25, 2023
1 parent 0c393c4 commit 4d671f6
Showing 1 changed file with 7 additions and 2 deletions.
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

0 comments on commit 4d671f6

Please sign in to comment.