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

@@ -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;