node-gh / gh

(DEPRECATED) GitHub CLI made with NodeJS. Use the official https://cli.github.com/ instead.
http://nodegh.io
Other
1.71k stars 217 forks source link

Side effect of unassign people from closed issue #584

Open earthbound19 opened 5 years ago

earthbound19 commented 5 years ago

I found that I can remove all assignees from a closed issue with a command like this, run from the directory of the git repo with an associated GitHub remote:

gh is --assign --assignee "" --number 362

--which may not have been any behavior that was intended for gh. What I want is an --unassign-all switch (feature request I suppose, unless it is intended behavior for an empty string assignee to remove all assignees).

Meanwhile, some side effects of this is that it reopened the issue and removed labels from the issue, and I don't want it doing either of those things--I want it to do only what I tell it to.

I don't know whether GitHub's API is making those (presumptuous) choices or gh. If the former this is not an issue with gh.

protoEvangelion commented 5 years ago

We use https://github.com/octokit/rest.js#readme under the hood and just pass it a list of assignees: https://github.com/node-gh/gh/blob/master/lib/cmds/issue.js#L352 to the edit endpoint.

However, their api endpoints have since updated and seem to be more granular.

We have not updated to their latest version yet so resolving this quickly is unlikely. I am in the process of building out our test suite so that we can confidently make sweeping changes like this.

To implement with their new api, we would probably have to list all assignees and then pass that list of assignees to the removeAssignees endpoint: https://octokit.github.io/rest.js/#api-Issues-removeAssignees

protoEvangelion commented 5 years ago

Just finished upgrading to their new api so this is possible now! https://octokit.github.io/rest.js/