mergeable
mergeable copied to clipboard
Can't assign certain authors?
We'd like to automatically assign a PR author to the PR. (Yes, this is an odd way to use assignments, but it helps with some of our tools). We use this in the mergeable.yml:
version: 2
mergeable: # see https://github.com/mergeability/mergeable
- when: pull_request.opened
name: 'Attempt to assign author'
validate:
- do: assignee
min:
count: 1 # Should be assigned to somebody; if not, assign author
pass:
- do: checks
status: 'success'
fail:
- do: assign
assignees: [ '@author' ]
- do: checks
status: 'success' # Supply the default actions, as if this passed.
payload:
title: 'Author assigned'
That works fine with the @author is a member of the project, but it doesn't assign authors who are not already members of the project. We then have to do that manually via the GitHub web page for the PR.
Not sure if this is a mergeability issue or something inherent in the GitHub interfaces.
Any suggestions of where to look to (start to) debug this? Thanks
hey @bobjacobsen, unfortunately this is a part of github's design, we check if user can be assigned using https://developer.github.com/v3/issues/assignees/#check-if-a-user-can-be-assigned before calling 'assign'. I personally don't know a work around for this. If you found a work around, do let us know. I would love to implement it in Mergeable if possible
Thanks for the quick reply! The behavior is a bit odd, as we definitely can assign the author through the web page. Their ID appears in the drop-down under Assignees, and can be selected from there, or we can type it in. I'll do some more research. Thanks again.
This seems to be a bug with mergeable as https://developer.github.com/v3/issues/assignees/#check-if-a-user-can-be-assigned is in the context of a repository, and not in the context of a PR / issue. The creator of a PR and issue can be assigned to that PR / issue (along with anyone else who has commented on the PR / issue) even when they can't be assigned in general to all PRs / issues in the repo.
Please see: https://docs.github.com/en/issues/tracking-your-work-with-issues/assigning-issues-and-pull-requests-to-other-github-users#about-issue-and-pull-request-assignees
You can assign multiple people to each issue or pull request, including yourself, anyone who has commented on the issue or pull request, anyone with write permissions to the repository, and organization members with read permissions to the repository.
I wonder if the check could simply be omitted? I.e. just try assigning without checking if it can be assigned, and if it fails it fails anyhow. Alternatively skip the check only when the '@author' option is used (although that may still prevent assignments under certain other valid cases).