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

create GH issue: assignees #1242

Closed
mattkrick opened this issue Aug 14, 2017 · 0 comments
Closed

create GH issue: assignees #1242

mattkrick opened this issue Aug 14, 2017 · 0 comments
Assignees
Labels

Comments

@mattkrick
Copy link
Member

mattkrick commented Aug 14, 2017

it's possible for an assignment to fail if the repo is public & the person creating the issue is not in the org. For example, parabolmatt can create an issue on a public repo, but cannot assign himself because he's not an admin.
Per GH docs:

If you have write access to a repository, you can assign issues and pull requests to yourself, collaborators on personal projects, or members of your organization with read permissions on the repository.

The above isn't entirely accurate because the GitHub website allows you to additionally assign contributors (not only collaborators), to personal repos if they created the issue in question. However, their checkAssignee endpoint still says they can't be assigned, even though they can be.

This actually gets fairly complicated. First, we need to check to see if the person creating the issue has write/admin access. Then, we need to see if the person they are adding is either a collaborator or a member. We can take care of the latter check by tightening up who can join/leave a repo. so that just leaves us with the write/admin access check.

  • get repo admin (the guy who created the integration)
  • with the admin's token, see if the issue creator has write or admin access
  • if write+ access, create the issue
  • assignee may still come back blank if the assignee no longer has read access to the repo. this could happen if they were removed from the org or as a collaborator. org hooks are not guaranteed since that requires admin access on the org. in the future, we should have membership hooks on the repo itself to guarantee success.
  • if only read access, create the issue & use the admin's token to update the assignee. @jordanh please confirm that this feels OK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant