feat: Add dismissal_restriction to PullRequestRuleParameters - #4599
Conversation
A ruleset's pull_request rule can restrict who may dismiss a review, in the same way a branch protection rule's dismissal_restrictions does. The REST API accepts and returns it as pull_request.dismissal_restriction and describes it in repository-rule-params-dismissal-restriction, but the parameters struct here stopped short of it, so a ruleset round-tripped through this client silently loses the restriction. Actor types are the enum GitHub documents for this field, which is not the same set as BypassActorType: an app is IntegrationInstallation here and Integration there.
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4599 +/- ##
=======================================
Coverage 98.60% 98.60%
=======================================
Files 198 198
Lines 18538 18538
=======================================
Hits 18279 18279
Misses 259 259 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
gmlewis
left a comment
There was a problem hiding this comment.
Thank you, @benlangfeld!
LGTM.
Awaiting second LGTM+Approval from any other contibutor to this repo before merging.
|
Thank you, @Not-Dhananjay-Mishra! |
dismissal_restriction to PullRequestRuleParameters
A ruleset's
pull_requestrule can restrict who may dismiss a review, the same way a branch protection rule'sdismissal_restrictionsdoes.PullRequestRuleParametersstops short of it, so a ruleset that has one round-trips through this client without it: unmarshalling drops the restriction, and marshalling the result back sends a rule that no longer has one.The REST API accepts and returns it as
pull_request.parameters.dismissal_restriction, and describes it asrepository-rule-params-dismissal-restriction:{ "title": "DismissalRestriction", "description": "Specify people, teams, or apps allowed to dismiss pull request reviews.", "properties": { "allowed_actors": { "type": "array", "items": { "$ref": "#/components/schemas/repository-rule-params-actor" } }, "enabled": { "type": "boolean" } }, "required": ["enabled"] }A live ruleset carries it whether or not it is in use — this is a repository ruleset created without one:
{"type": "pull_request", "parameters": {"dismissal_restriction": {"allowed_actors": [], "enabled": false}, ...}}enabledis required by the schema, so it is a plainbool;allowed_actorsis optional and omitted when empty.The actor type is its own enum rather than a reuse of
BypassActorType, because GitHub documents a different set for this field:User,Team,IntegrationInstallation,RepositoryRole. An app isIntegrationInstallationhere andIntegrationin a bypass actor, so sharing the type would let a value that is valid in one place be written into the other.Accessors are regenerated. Two round-trip cases are added to
TestRepositoryRule: one restricting dismissal to a team and the admin repository role, and one enabling the restriction with no allowed actors, which is how "administrators only" is expressed.