diff --git a/changelog/README.md b/changelog/README.md index 68ac54f..ba03f43 100644 --- a/changelog/README.md +++ b/changelog/README.md @@ -138,7 +138,7 @@ submit workflow (write permissions, via workflow_run) │ └── posts PR comment with view/edit links │ ├── if "no-label": - │ └── posts PR comment listing available labels + │ └── posts PR comment listing available type labels and skip labels │ └── otherwise (skipped, manually-edited): no-op ``` @@ -169,7 +169,7 @@ rules: exclude: "changelog:skip" ``` -When all products are blocked by the create rules, the validate action passes with `skipped` status (so CI stays green) and the submit action exits without generating. If no matching type label is found (including when labels exist but none correspond to a configured type or skip rule), validate fails with `no-label` and submit posts a comment listing the available labels. You can also use `include` mode or per-product overrides. See [Rules for creation and publishing](https://elastic.github.io/docs-builder/contribute/changelog/#rules-for-creation-and-publishing) for the full reference. +When all products are blocked by the create rules, the validate action passes with `skipped` status (so CI stays green) and the submit action exits without generating. If no matching type label is found (including when labels exist but none correspond to a configured type or skip rule), validate fails with `no-label` and submit posts a comment listing the available type labels and skip labels (if configured), so contributors know how to opt out of changelog generation. You can also use `include` mode or per-product overrides. See [Rules for creation and publishing](https://elastic.github.io/docs-builder/contribute/changelog/#rules-for-creation-and-publishing) for the full reference. ## Manual edits diff --git a/changelog/submit/action.yml b/changelog/submit/action.yml index fff2460..1cc48c3 100644 --- a/changelog/submit/action.yml +++ b/changelog/submit/action.yml @@ -251,6 +251,7 @@ runs: PR_NUMBER: ${{ steps.pr.outputs.number }} LABEL_TABLE: ${{ steps.evaluate.outputs.label-table }} PRODUCT_LABEL_TABLE: ${{ steps.evaluate.outputs.product-label-table }} + SKIP_LABELS: ${{ steps.evaluate.outputs.skip-labels }} CONFIG_FILE: ${{ inputs.config }} with: github-token: ${{ inputs.github-token }} diff --git a/changelog/submit/scripts/post-failure-comment.js b/changelog/submit/scripts/post-failure-comment.js index 7ac362b..f77fb32 100644 --- a/changelog/submit/scripts/post-failure-comment.js +++ b/changelog/submit/scripts/post-failure-comment.js @@ -5,6 +5,7 @@ module.exports = async ({ github, context, core }) => { const configFile = process.env.CONFIG_FILE || 'docs/changelog.yml'; const labelRows = process.env.LABEL_TABLE || ''; const productLabelRows = process.env.PRODUCT_LABEL_TABLE || ''; + const skipLabels = process.env.SKIP_LABELS || ''; let labelSection; if (labelRows.trim()) { @@ -28,14 +29,23 @@ module.exports = async ({ github, context, core }) => { ].join('\n'); } + let skipSection; + if (skipLabels.trim()) { + const formatted = skipLabels.split(',').map(l => `\`${l.trim()}\``).join(', '); + skipSection = `\n⏭️ To skip changelog generation, add one of these labels: ${formatted}`; + } else { + skipSection = `\n⏭️ No skip labels are configured. To allow skipping changelog generation, add a label to \`rules.create.exclude\` in \`${configFile}\`.`; + } + const body = [ TITLE, '', '⚠️ **Cannot generate changelog:** no matching type label found on this PR.', labelSection, productSection, + skipSection, '', - `🔖 To skip changelog generation or configure label rules, see \`${configFile}\`.`, + `📄 See \`${configFile}\` for the full changelog configuration.`, ].join('\n'); await upsertComment({ github, context, prNumber, body });