mirror of
https://github.com/xuexb/github-bot.git
synced 2025-12-08 17:36:07 +00:00
feat: add pkg.config.github-bot config
This commit is contained in:
parent
0d1ed1e980
commit
d8760ea265
@ -4,7 +4,7 @@
|
||||
|
||||
- [x] 不规范 issue 自动关闭
|
||||
- [x] 当 issue 标记 label 为 `need demo`时,自动回复,需要相关demo
|
||||
- [x] issue 自动 `assign` 给指定人员
|
||||
- [x] issue 自动 `assign` 给指定人员,需要配置 `package.json` 中 `config.github-bot.lableToAuthor` 映射
|
||||
- [x] 当往远程第一次推送新版本号时,自动列出最新版本距离上一版本的 commit log 并发布 release notes
|
||||
- [ ] 发 PR 时标题不规范时提醒修改
|
||||
|
||||
|
||||
@ -33,6 +33,13 @@
|
||||
},
|
||||
"validate-commit-msg": {
|
||||
"types": ["feat", "fix", "docs", "style", "test", "chore", "revert", "close"]
|
||||
},
|
||||
"github-bot": {
|
||||
"lableToAuthor": {
|
||||
"bug": "xuexb",
|
||||
"enhancement": "xuexb",
|
||||
"question": "xuexb"
|
||||
}
|
||||
}
|
||||
},
|
||||
"os": ["darwin", "linux"],
|
||||
|
||||
@ -3,13 +3,11 @@
|
||||
* @author xuexb <fe.xiaowu@gmail.com>
|
||||
*/
|
||||
|
||||
const {getPkgConfig} = require('../../utils');
|
||||
const {addAssigneesToIssue} = require('../../github');
|
||||
|
||||
const assignMap = {
|
||||
bug: 'xuexb',
|
||||
enhancement: 'xuexb',
|
||||
question: 'xuexb'
|
||||
};
|
||||
const config = getPkgConfig();
|
||||
const assignMap = config.lableToAuthor || {};
|
||||
|
||||
function autoAssign(on) {
|
||||
on('issues_labeled', ({payload, repo}) => {
|
||||
|
||||
14
src/utils.js
14
src/utils.js
@ -110,6 +110,20 @@ const utils = {
|
||||
*/
|
||||
getTags({dir}) {
|
||||
return execSync(`cd ${dir} && git tag -l`).toString().split(/\n+/).filter(tag => !!tag).reverse();
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取 package.json 里的 config.github-bot
|
||||
*
|
||||
* @return {Object}
|
||||
*/
|
||||
getPkgConfig() {
|
||||
const pkg = require('../package.json');
|
||||
const config = Object.assign({
|
||||
'github-bot': {}
|
||||
}, pkg.config);
|
||||
|
||||
return config['github-bot'];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user