Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Setting protection is broken with existing "restrict who can push" setup #1131

Open
@ccotter

Description

@ccotter

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

protection.update(required_pull_request_reviews={ ... })
  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 someprints)

While github3 is creating thePUT 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 thinkhttps://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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp