mirror of
https://github.com/xuexb/github-bot.git
synced 2026-01-25 14:06:59 +00:00
feat: add label based on content
This commit is contained in:
parent
8a99cf188c
commit
22f8f9c009
17
src/modules/issues/autoLabel.js
Normal file
17
src/modules/issues/autoLabel.js
Normal file
@ -0,0 +1,17 @@
|
||||
/**
|
||||
* @file 自动根据创建的 issue 内标识创建对应 label
|
||||
* @author xuexb <fe.xiaowu@gmail.com>
|
||||
*/
|
||||
|
||||
const { addLabelsToIssue } = require('../../github')
|
||||
|
||||
function autoAssign (on) {
|
||||
on('issues_opened', ({ payload, repo }) => {
|
||||
const label = (payload.issue.body.match(/<!--\s*label:\s*(.+?)\s*-->/) || [])[1]
|
||||
if (label) {
|
||||
addLabelsToIssue(payload, label)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = autoAssign
|
||||
Loading…
x
Reference in New Issue
Block a user