Skip to content

Commit

Permalink
Fix not being able to delete bypass_actors
Browse files Browse the repository at this point in the history
This is a quirk upstream, where they introduced a new function
`UpdateRulesetNoBypassActor` to work around the issue of
`UpdateRuleset` not deleting BypassActors when there's an empty array.
google/go-github#3174

Not sure why they decided to introduce a new function instead of just
patching the original. Compatibility issues?
Is there ever a use case where we need to keep BypassActors around
when the non-empty list becomes an empty list?
  • Loading branch information
ben-z committed Dec 4, 2024
1 parent 9c785b1 commit 312d923
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
2 changes: 1 addition & 1 deletion github/resource_github_repository_ruleset.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ func resourceGithubRepositoryRulesetUpdate(d *schema.ResourceData, meta interfac

ctx := context.WithValue(context.Background(), ctxId, rulesetID)

ruleset, _, err := client.Repositories.UpdateRuleset(ctx, owner, repoName, rulesetID, rulesetReq)
ruleset, _, err := client.Repositories.UpdateRulesetNoBypassActor(ctx, owner, repoName, rulesetID, rulesetReq)
if err != nil {
return err
}
Expand Down
3 changes: 0 additions & 3 deletions github/respository_rules_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ func resourceGithubRulesetObject(d *schema.ResourceData, org string) *github.Rul
}

func expandBypassActors(input []interface{}) []*github.BypassActor {
if len(input) == 0 {
return nil
}
bypassActors := make([]*github.BypassActor, 0)

for _, v := range input {
Expand Down

0 comments on commit 312d923

Please sign in to comment.