Skip to content

refactor!: Change GetRulesForBranch to ListRulesForBranch#4229

Open
gmlewis wants to merge 2 commits into
google:masterfrom
gmlewis:GetRulesForBranch
Open

refactor!: Change GetRulesForBranch to ListRulesForBranch#4229
gmlewis wants to merge 2 commits into
google:masterfrom
gmlewis:GetRulesForBranch

Conversation

@gmlewis
Copy link
Copy Markdown
Collaborator

@gmlewis gmlewis commented May 14, 2026

BREAKING CHANGE: RepositoriesService.GetRulesForBranch is now RepositoriesService.ListRulesForBranch.

Relates to: #4117.

Signed-off-by: Glenn Lewis <6598971+gmlewis@users.noreply.github.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 14, 2026

Codecov Report

❌ Patch coverage is 25.92593% with 60 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.45%. Comparing base (d9f9997) to head (0aa5a2f).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
github/repos_rules.go 25.92% 39 Missing and 21 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4229      +/-   ##
==========================================
- Coverage   97.75%   97.45%   -0.31%     
==========================================
  Files         189      189              
  Lines       19035    19115      +80     
==========================================
+ Hits        18608    18628      +20     
- Misses        231      270      +39     
- Partials      196      217      +21     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Glenn Lewis <6598971+gmlewis@users.noreply.github.com>
@gmlewis gmlewis added the NeedsReview PR is awaiting a review before merging. label May 14, 2026
@gmlewis
Copy link
Copy Markdown
Collaborator Author

gmlewis commented May 14, 2026

@gmlewis
Copy link
Copy Markdown
Collaborator Author

gmlewis commented May 14, 2026

Note that I'm not terribly concerned about the code coverage report in this PR since the JSON custom unmarshaler is tested separately.

Copy link
Copy Markdown
Contributor

@stevehipwell stevehipwell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, just a minor question.

Comment thread github/repos_rules.go
// Note that since [BranchRules] contains a large number of slices, this iterator
// returns type `any` and it is therefore the responsibility of the caller to perform a
// type switch to determine what item is being returned for each iteration.
func (s *RepositoriesService) ListRulesForBranchIter(ctx context.Context, owner, repo, branch string, opts *ListOptions) iter.Seq2[any, error] {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see why this iterator isn't being generated, but do you need to add some configuration to block the generator or will it see that this already exists?

I'd also like a go refactoring it once it's merged as I think we could make the API a bit more specific and remove any.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

NeedsReview PR is awaiting a review before merging.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants