Skip to content

Commit 22f8f9c

Browse files
xuexbyugasun
authored andcommitted
feat: add label based on content
1 parent 8a99cf1 commit 22f8f9c

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

src/modules/issues/autoLabel.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* @file 自动根据创建的 issue 内标识创建对应 label
3+
* @author xuexb <[email protected]>
4+
*/
5+
6+
const { addLabelsToIssue } = require('../../github')
7+
8+
function autoAssign (on) {
9+
on('issues_opened', ({ payload, repo }) => {
10+
const label = (payload.issue.body.match(/<!--\s*label:\s*(.+?)\s*-->/) || [])[1]
11+
if (label) {
12+
addLabelsToIssue(payload, label)
13+
}
14+
})
15+
}
16+
17+
module.exports = autoAssign

0 commit comments

Comments
 (0)