docs: close pr on wrong format, reopen to rescan (#6669)

* template: enforcing rules and use reopen as trigger to retest route
This commit is contained in:
NeverBehave
2021-01-11 10:49:57 -05:00
committed by GitHub
parent 428f171fcc
commit 3a553c7f1c
3 changed files with 23 additions and 6 deletions

View File

@@ -44,7 +44,7 @@ module.exports = async ({ github, context, core }, body, number) => {
}
}
core.info('seems no route found, failing');
core.warning('seems no route found, failing');
await github.issues
.addLabels({
@@ -56,6 +56,25 @@ module.exports = async ({ github, context, core }, body, number) => {
.catch((e) => {
core.warning(e);
});
await github.issues
.createComment({
issue_number: number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `自动检测失败, 请确认PR正文部分符合格式规范并重新开启, 详情请检查日志
Auto Route test failed, please check your PR body format and reopen pull request. Check logs for more details`,
})
.catch((e) => {
core.warning(e);
});
await github.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_nulber: number,
state: "closed"
}).catch((e) => {
core.warning(e);
});
throw 'Please follow the PR rules: failed to detect route';
};