Visitar URL original
Add/remove labels to an issue by oktapodia · Pull Request #624 · github-tools/github · GitHub
Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add addLabel() to add a label to an issue
  • Loading branch information
asmsuechan authored and oktapodia committed Aug 14, 2020
commit 9671d24ef3c22431bdf90c2f5b33754c02b6e6e1
12 changes: 12 additions & 0 deletions lib/Issue.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,18 @@ class Issue extends Requestable {
deleteLabel(label, cb) {
return this._request('DELETE', `/repos/${this.__repository}/labels/${label}`, null, cb);
}

/**
* Add label to an issue
* @see https://developer.github.com/v3/issues/labels/#add-labels-to-an-issue
* @param {number} issue - the id of the issue to comment on
* @param {string} label - the name of the label to add to the issue
* @param {Requestable.callback} [cb] - will receive the status
* @return {Promise} - the promise for the http request
*/
addLabel(issue, label, cb) {
return this._request('POST', `/repos/${this.__repository}/issues/${issue}/labels`, label, cb);
}
}

module.exports = Issue;