feat: add pkg.config.github-bot config

This commit is contained in:
xuexb 2017-10-15 10:51:56 +08:00
parent 0d1ed1e980
commit d8760ea265
4 changed files with 25 additions and 6 deletions

View File

@ -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 时标题不规范时提醒修改

View File

@ -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"],

View File

@ -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}) => {

View File

@ -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'];
}
};