-
-
Notifications
You must be signed in to change notification settings - Fork 20
/
index.js
34 lines (27 loc) · 824 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/**
* @fileoverview Adds a newly opened issue to the Triage project
* @author Nicholas C. Zakas
*/
"use strict";
const { NEEDS_TRIAGE_COLUMN_ID } = require("../../constants");
/**
* Adds the issue to the triage project.
* @param {Context} context Probot webhook event context
* @returns {Promise<void>} A Promise that fulfills when the action is complete
* @private
*/
async function triage(context) {
const issue = context.payload.issue;
// issues with "triage:no" label are exempt
if (issue.labels.some(label => label.name === "triage:no")) {
return;
}
await context.github.projects.createCard({
column_id: NEEDS_TRIAGE_COLUMN_ID,
content_id: issue.id,
content_type: "Issue"
});
}
module.exports = robot => {
robot.on("issues.opened", triage);
};