go-github icon indicating copy to clipboard operation
go-github copied to clipboard

Allow an empty array of BypassActors in Ruleset struct in CreateRuleset endpoint

Open Matthew-Reidy opened this issue 1 year ago • 6 comments

Fixes: #3137

added an extra Ruleset struct and CreateRuleset endpoint in repo_rules.go to allow the BypassActors field to be passed as nil or an empty array

Matthew-Reidy avatar May 22 '24 18:05 Matthew-Reidy

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 92.92%. Comparing base (2b8c7fa) to head (fa5bba3). Report is 78 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3174      +/-   ##
==========================================
- Coverage   97.72%   92.92%   -4.80%     
==========================================
  Files         153      171      +18     
  Lines       13390    11582    -1808     
==========================================
- Hits        13085    10763    -2322     
- Misses        215      726     +511     
- Partials       90       93       +3     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar May 22 '24 19:05 codecov[bot]

Do you mean something like having an anonymous struct identical to Ruleset in the new functions scope that would just copy over the values of Ruleset to? I understand your idea but i'm confused about the implementation.

Matthew-Reidy avatar May 23 '24 16:05 Matthew-Reidy

Do you mean something like having an anonymous struct identical to Ruleset in the new functions scope that would just copy over the values of Ruleset to? I understand your idea but i'm confused about the implementation.

Yes, that is what I mean.

We have other examples of this in our repo.

Here is one of many: https://github.com/google/go-github/blob/master/github/repos.go#L546-L573

I found this by typing:

$ grep 'type [a-z]' github/*.go

gmlewis avatar May 23 '24 18:05 gmlewis

made some changes. Let me know if its what you expected.

Matthew-Reidy avatar May 30 '24 19:05 Matthew-Reidy

Ok. I commited your suggested changes. I didn't know rulesetNoOmitBypassActors made it non exported. Learned something new about the language. Thanks!

Matthew-Reidy avatar May 30 '24 20:05 Matthew-Reidy

Please re-run step 4 in CONTRIBUTING.md to re-generate the auto-generated files... then the tests should all pass. You can also test locally before you push by running go test ./...

gmlewis avatar May 30 '24 20:05 gmlewis

This would be useful for me as I'm tracking a bug in the GitHub terraform provider that I think links to #3137.

@Matthew-Reidy are you planning on picking this up again?

lewismiddleton avatar Jul 08 '24 09:07 lewismiddleton

I can fix the spelling mistake/nit but as for the other proposed change, whats the justification? The solution in place now on this PR seems to do the same things and has testing evidence behind it. Thanks.

Matthew-Reidy avatar Jul 09 '24 15:07 Matthew-Reidy

Thank you, @tomfeigin and @Matthew-Reidy ! @tomfeigin - after this is merged, feel free to create a PR to improve the styling if you wish.

Merging.

gmlewis avatar Jul 09 '24 18:07 gmlewis