diff --git a/.github/workflows/auto-label-by-package.yml b/.github/workflows/auto-label-by-package.yml index 0a4ed67c0ca..a9dfd651685 100644 --- a/.github/workflows/auto-label-by-package.yml +++ b/.github/workflows/auto-label-by-package.yml @@ -20,9 +20,15 @@ jobs: script: | const body = context.payload.issue.body || ""; - // Extract text under "### Package" (handles " (Required)" suffix and being last section) - const match = body.match(/### Package[^\n]*\n([\s\S]*?)(?:\n###|$)/i); - if (!match) return; + // Extract text under "## Package" or "### Package" (handles " (Required)" suffix and being last section) + const match = body.match(/#{2,3} Package[^\n]*\n([\s\S]*?)(?:\n#{2,3} |$)/i); + if (!match) { + core.setFailed( + `Could not find "## Package" section in issue #${context.issue.number} body. ` + + `The issue template may have changed — update the regex in this workflow.` + ); + return; + } const packageSection = match[1].trim();