From ce1d2137ecdd1a779bab9f368bdeb3405f6a7092 Mon Sep 17 00:00:00 2001 From: Major Hayden Date: Fri, 21 Aug 2026 14:01:14 -0500 Subject: [PATCH] fix(ci): check PR body for linked issue on non-default branches - fall back to parsing PR description for issue references in pr-standards - prevent false-positive needs:issue labels on PRs targeting v2 Signed-off-by: Major Hayden --- .github/workflows/pr-standards.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-standards.yml b/.github/workflows/pr-standards.yml index 06838089d354..0d4bb85537e6 100644 --- a/.github/workflows/pr-standards.yml +++ b/.github/workflows/pr-standards.yml @@ -135,7 +135,16 @@ jobs: const linkedIssues = result.repository.pullRequest.closingIssuesReferences.totalCount; - if (linkedIssues === 0) { + // GitHub only populates closingIssuesReferences when a PR targets the repository's + // default branch (dev). PRs targeting other branches like v2 always return totalCount 0. + // Fall back to checking the PR description for closing keywords (e.g. Closes #123). + const body = pr.body || ''; + const issueMatch = body.match(/### Issue for this PR\s*\n([\s\S]*?)(?=###|$)/); + const issueContent = issueMatch ? issueMatch[1].trim() : body; + const hasBodyIssueRef = /(closes|fixes|resolves)\s+#\d+/i.test(issueContent) || /#\d+/.test(issueContent); + const hasLinkedIssue = linkedIssues > 0 || hasBodyIssueRef; + + if (!hasLinkedIssue) { await addLabel('needs:issue'); await comment('issue', `Thanks for your contribution!