Skip to content

Commit 2cd8a94

Browse files
authored
[bug]: branch_protection - added missing App DismissalActorTypes
2 parents 6d97704 + 91f7e26 commit 2cd8a94

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

github/util_v4_branch_protection.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ type ActorUser struct {
2424

2525
type DismissalActorTypes struct {
2626
Actor struct {
27+
App Actor `graphql:"... on App"`
2728
Team Actor `graphql:"... on Team"`
2829
User ActorUser `graphql:"... on User"`
2930
}
@@ -340,7 +341,7 @@ func setDismissalActorIDs(actors []DismissalActorTypes, data BranchProtectionRes
340341
for _, a := range actors {
341342
IsID := false
342343
for _, v := range data.ReviewDismissalActorIDs {
343-
if (a.Actor.Team.ID != nil && a.Actor.Team.ID.(string) == v) || (a.Actor.User.ID != nil && a.Actor.User.ID.(string) == v) {
344+
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) {
344345
dismissalActors = append(dismissalActors, v)
345346
IsID = true
346347
break
@@ -353,6 +354,10 @@ func setDismissalActorIDs(actors []DismissalActorTypes, data BranchProtectionRes
353354
}
354355
if a.Actor.User.Login != "" {
355356
dismissalActors = append(dismissalActors, "/"+string(a.Actor.User.Login))
357+
continue
358+
}
359+
if a.Actor.App != (Actor{}) {
360+
dismissalActors = append(dismissalActors, a.Actor.App.ID.(string))
356361
}
357362
}
358363
}
@@ -561,7 +566,7 @@ func getBranchProtectionID(repoID githubv4.ID, pattern string, meta interface{})
561566
}
562567
}
563568

564-
return nil, fmt.Errorf("could not find a branch protection rule with the pattern '%s'.", pattern)
569+
return nil, fmt.Errorf("could not find a branch protection rule with the pattern '%s'", pattern)
565570
}
566571

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

0 commit comments

Comments
 (0)