Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

r/github_branch_protection: check invalid users #158

Merged
merged 1 commit into from
Jul 16, 2019

Conversation

shihanng
Copy link
Contributor

@shihanng shihanng commented Oct 3, 2018

Hi, this is PR an attempt to fix #95. As reported in the issue the GitHUB V3 API does not report error when invalid user login are submitted to replace user restrictions of protected branch. It seems that the API ignores the invalid user and update the list only with the valid ones. It also return the updated list as part of the response.

$ curl -i -d '["shihanng", "shihan_ng"]' -X PUT -H "Authorization: token $GITHUB_TOKEN" -H "Content-Type: application/json" https://api.github.com/repos/shihanng-org/test/branches/master/protection/restrictions/users
HTTP/1.1 200 OK
Date: Wed, 03 Oct 2018 02:30:48 GMT
...

[
  {
    "login": "shihanng",
    ...
    "type": "User",
    "site_admin": false
  }
]

This PR includes a way to check the resulting users list from the response and compare it with the user input in order to report the error properly.

Please let me know what you think. Thank you.

@ghost ghost added the size/M label Oct 3, 2018
@radeksimko radeksimko added Type: Feature New feature or request thinking labels Oct 24, 2018
Copy link
Contributor

@tracypholmes tracypholmes left a comment

Choose a reason for hiding this comment

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

Hi @shihanng! Thanks for this PR. LGTM 👍

@tracypholmes tracypholmes merged commit 885cb94 into integrations:master Jul 16, 2019
@shihanng shihanng deleted the invalid-users branch July 17, 2019 12:52
kfcampbell pushed a commit to kfcampbell/terraform-provider-github that referenced this pull request Jul 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No error reported when using an invalid user name in branch protection restriction
3 participants