Closed jbjonesjr closed 6 years ago
You should be able to only perform the
issue.edit
if the labels have changed, aka, something like:
Ahh, good catch.
Next, since adding a label to an issue requires you to determine if it already exists for the issue, use iterators/find, conditionals, and then and updating the issue if necessary, it would be awesome if this could be abstracted from the user.
I think you can use this endpoint (github.issues.addLabels
on node-github) to add labels to an issue, and it doesn't care if the label is already on the issue.
Is this still relevant? If so, please comment with any updates or addition details.
https://github.com/probot/reminders/blob/bf6e72f55b8a85b95e10daa52ae42ff9c2fb50c6/lib/reminders.js#L22-L26
First, slight optimization:
You should be able to only perform the
issue.edit
if the labels have changed, aka, something like:(labels.length != issue.labels.length) await context.github.issues.edit(context.issue({labels}));
(or whatever the proper modern javascript syntax is for that)Next, since adding a label to an issue requires you to determine if it already exists for the issue, use iterators/find, conditionals, and then and updating the issue if necessary, it would be awesome if this could be abstracted from the user. Whether a little
node-github
helper library ornode-github
itself, providing some abstracted, optimized methods for tasks like this would help all. Of course, it would be great if the GitHub API supported this, but we could provide some JS help in the meantime. Thoughts?