From 3c21283045224c7dc5063dd0c5e90c5b4ae0b4cf Mon Sep 17 00:00:00 2001 From: majestic-owl448 <26656284+majestic-owl448@users.noreply.github.com> Date: Mon, 16 Mar 2026 15:38:22 +0100 Subject: [PATCH] fix: strip markdown links when checking PR template checkboxes (#66494) --- .github/scripts/pr-guidelines/check-pr-template.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/scripts/pr-guidelines/check-pr-template.js b/.github/scripts/pr-guidelines/check-pr-template.js index d74bc0d7682..174badac61c 100644 --- a/.github/scripts/pr-guidelines/check-pr-template.js +++ b/.github/scripts/pr-guidelines/check-pr-template.js @@ -32,11 +32,15 @@ module.exports = async ({ github, context, isAllowListed }) => { // acceptable to leave unticked. const templatePresent = body.includes('Checklist:'); const requiredTicked = [ - 'I have read and followed the [contribution guidelines]', - 'I have read and followed the [how to open a pull request guide]', + 'I have read and followed the contribution guidelines', + 'I have read and followed the how to open a pull request guide', 'My pull request targets the' ]; - const normalizedBody = body.replace(/\[\s*[xX]\s*\]/g, '[x]'); + // Strip markdown links ([text](url) → text) before matching so contributors + // who omit the link syntax (e.g. type plain text) still pass the check. + const normalizedBody = body + .replace(/\[\s*[xX]\s*\]/g, '[x]') + .replace(/\[([^\]]+)\]\([^)]+\)/g, '$1'); const allRequiredTicked = requiredTicked.every(item => normalizedBody.includes(`[x] ${item}`) );