Skip to content

Commit f2984e2

Browse files
committed
Add workaround for GH API bug that OrgAdmin actor_id is returned as null
Signed-off-by: Timo Sand <[email protected]>
1 parent 8398dd2 commit f2984e2

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

github/util_rules.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,15 @@ func flattenBypassActors(bypassActors []*github.BypassActor) []any {
133133
actorsSlice := make([]any, 0)
134134
for _, v := range bypassActors {
135135
actorMap := make(map[string]any)
136-
137-
actorMap["actor_id"] = v.GetActorID()
138-
actorMap["actor_type"] = v.GetActorType()
136+
actorID := v.GetActorID()
137+
actorType := v.GetActorType()
138+
if *actorType == github.BypassActorTypeOrganizationAdmin && actorID == 0 {
139+
// This is a workaround for the GitHub API bug where OrganizationAdmin actor_id is returned as `null` instead of `1`
140+
log.Printf("[DEBUG] Setting OrganizationAdmin Actor ID to 1")
141+
actorID = 1
142+
}
143+
actorMap["actor_id"] = actorID
144+
actorMap["actor_type"] = actorType
139145
actorMap["bypass_mode"] = v.GetBypassMode()
140146

141147
actorsSlice = append(actorsSlice, actorMap)

0 commit comments

Comments
 (0)