You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With v3.2.0, when a branch protection is setup on a branch with "Restrict who can push to matching branches" enabled with one or more users or team, and no other protections are enabled, then when attempting to add more protections, the github3 fails with
File "/home/ccotter/git/policy_bot/src/policy_bot.py", line 225, in validate_branch
protection.update(required_pull_request_reviews={}, restrictions=restrictions)
File "/home/ccotter/git/policy_bot/venv/lib/python3.10/site-packages/github3/decorators.py", line 24, in auth_wrapper
return func(self, *args, **kwargs)
File "/home/ccotter/git/policy_bot/venv/lib/python3.10/site-packages/github3/repos/branch.py", line 469, in update
json = self._json(self._put(self._api, json=edit), 200)
File "/home/ccotter/git/policy_bot/venv/lib/python3.10/site-packages/github3/models.py", line 161, in _json
raise exceptions.error_for(response)
github3.exceptions.UnprocessableEntity: 422 Invalid request.
No subschema in "anyOf" matched.
(Note the line number from the github3 code are a bit off as I added some prints)
While github3 is creating the PUT HTTP request, it ends up inserting the the entire restrictions value from the original request that retrieved the restrictions, and the PUT request ends up containing an invalid payload. To fix, I think https://github.com/sigmavirus24/github3.py/blob/3.2.0/src/github3/repos/branch.py#L460 needs to extract out only the login name of each user, and the team name of each time. If I get a chance, I can submit a fix for this.
The text was updated successfully, but these errors were encountered:
With v3.2.0, when a branch protection is setup on a branch with "Restrict who can push to matching branches" enabled with one or more users or team, and no other protections are enabled, then when attempting to add more protections, the github3 fails with
(Note the line number from the github3 code are a bit off as I added some
prints
)While github3 is creating the
PUT
HTTP request, it ends up inserting the the entirerestrictions
value from the original request that retrieved therestrictions
, and thePUT
request ends up containing an invalid payload. To fix, I think https://github.com/sigmavirus24/github3.py/blob/3.2.0/src/github3/repos/branch.py#L460 needs to extract out only the login name of each user, and the team name of each time. If I get a chance, I can submit a fix for this.The text was updated successfully, but these errors were encountered: