Skip to content

Commit 1ffd44d

Browse files
committed
Add addLabel() to add a label to an issue
1 parent 22b889c commit 1ffd44d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/Issue.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,18 @@ class Issue extends Requestable {
246246
deleteLabel(label, cb) {
247247
return this._request('DELETE', `/repos/${this.__repository}/labels/${label}`, null, cb);
248248
}
249+
250+
/**
251+
* Add label to an issue
252+
* @see https://developer.github.com/v3/issues/labels/#add-labels-to-an-issue
253+
* @param {number} issue - the id of the issue to comment on
254+
* @param {string} label - the name of the label to add to the issue
255+
* @param {Requestable.callback} [cb] - will receive the status
256+
* @return {Promise} - the promise for the http request
257+
*/
258+
addLabel(issue, label, cb) {
259+
return this._request('POST', `/repos/${this.__repository}/issues/${issue}/labels`, label, cb);
260+
}
249261
}
250262

251263
module.exports = Issue;

0 commit comments

Comments
 (0)