chore: update the "routes" example in the pull request template to make it less confusing (#14415)

* Fix: a typo in the pull request template

* Enhance: when parsing routes from PR body, remove all comments.
This commit is contained in:
piglei
2024-02-07 15:16:00 +08:00
committed by GitHub
parent 84d2c9be6b
commit dc4eb8d02b
2 changed files with 4 additions and 2 deletions

View File

@@ -15,7 +15,7 @@ Fail to comply will result in your pull request being closed automatically.
请在 `routes` 区域填写以 / 开头的完整路由地址,否则你的 PR 将会被无条件关闭。
如果路由包含在文档中列出可以完全穷举的参数(例如分类),请依次全部列出。
```route
```routes
/some/route
/some/other/route
/dont/use/this/or/modify/it

View File

@@ -4,7 +4,9 @@ const allowedUser = new Set(['dependabot[bot]', 'pull[bot]']); // dependabot and
module.exports = async ({ github, context, core }, body, number, sender) => {
core.debug(`sender: ${sender}`);
core.debug(`body: ${body}`);
const m = body.match(/```routes\s+([\S\s]*?)```/);
// Remove all HTML comments before performing the match
const bodyNoCmts = body.replaceAll(/<!--[\S\s]*?-->/g, '');
const m = bodyNoCmts.match(/```routes\s+([\S\s]*?)```/);
core.debug(`match: ${m}`);
let res = null;