Skip to content

Commit 4dbad69

Browse files
authored
chore: fail if more than one changelog label is applied to a PR (#14382)
There should be at most one `changelog-*` label per PR, which later determine the section of the release notes where the PR will appear.
1 parent 4ee6ea0 commit 4dbad69

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

.github/workflows/pr-body.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,12 @@ jobs:
2121
# never interpolated into shell commands, eval'd, or written to GITHUB_ENV/GITHUB_OUTPUT.
2222
script: |
2323
const { title, body, labels, draft } = context.payload.pull_request;
24+
const changelogLabels = labels.filter(label => label.name.startsWith("changelog-"));
25+
if (changelogLabels.length > 1) {
26+
core.setFailed('PR must not have more than one `changelog-*` label (found: ' + changelogLabels.map(label => label.name).join(', ') + ')');
27+
}
2428
if (!draft && /^(feat|fix):/.test(title) && !labels.some(label => label.name == "changelog-no")) {
25-
if (!labels.some(label => label.name.startsWith("changelog-"))) {
29+
if (changelogLabels.length === 0) {
2630
core.setFailed('feat/fix PR must have a `changelog-*` label');
2731
}
2832
if (!/^This PR [^<]/.test(body)) {

0 commit comments

Comments
 (0)