Skip to content

Conversation

@stevehipwell
Copy link
Contributor

This PR fixes a bug where the merge methods for a pull request ruleset rule always need to be defined instead of being able to be unset.

@gmlewis gmlewis changed the title fix: Ignore unset ruleset pr merge methods field fix: Ignore unset AllowedMergeMethods field Jan 8, 2026
@codecov
Copy link

codecov bot commented Jan 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.44%. Comparing base (ce49609) to head (377e05b).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3905   +/-   ##
=======================================
  Coverage   92.44%   92.44%           
=======================================
  Files         203      203           
  Lines       14927    14927           
=======================================
  Hits        13799    13799           
  Misses        926      926           
  Partials      202      202           

☔ 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.

Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

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

Thank you, @stevehipwell!
LGTM.
Merging.

@gmlewis gmlewis merged commit 4456d12 into google:master Jan 8, 2026
8 checks passed
// PullRequestRuleParameters represents the pull_request rule parameters.
type PullRequestRuleParameters struct {
AllowedMergeMethods []PullRequestMergeMethod `json:"allowed_merge_methods"`
AllowedMergeMethods []PullRequestMergeMethod `json:"allowed_merge_methods,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm curious, can we use omitzero here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure why we'd want to? This field can either be missing or it needs to have at least 1 value.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The unit test does show that this field is being properly omitted when empty. In hindsight, adding a second unit test demonstrating BOTH behaviors would be beneficial.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh, never mind. It does indeed look like the table-driven tests also include that behavior, so I think we are all good here.

@stevehipwell stevehipwell deleted the fix-ruleset-pr-merge-methods branch January 8, 2026 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants