Require release notes to be present (#64238)

Release notes are the sole information users have about what could
either have improved or have been broken for them. Omitting release
notes is one thing, but not writing any or having empty ones helps
nobody - users get no context on what could cause issues they were
seeing nor do they know about potential improvements, triagers cannot
easily find the PR that could have introduced the bug either.

Thus, this PR now makes it so that danger actually requires one to write
release notes. Empty release notes or the placeholder will no longer be
accepted.

Release Notes:

- N/A
This commit is contained in:
Finn Evers
2026-09-15 13:38:45 +00:00
committed by GitHub
parent 0be5558912
commit 93f9fce115
2 changed files with 18 additions and 9 deletions
+17 -3
View File
@@ -1,4 +1,4 @@
import { danger, message, warn, fail, schedule } from "danger";
import { danger, message, fail, schedule } from "danger";
import { releaseNotesSection, releaseNotesEntries } from "../lib/release-notes";
const { prHygiene } = require("danger-plugin-pr-hygiene");
@@ -16,10 +16,11 @@ prHygiene({
const body = danger.github.pr.body;
const releaseNotes = releaseNotesSection(body);
const entries = releaseNotesEntries(releaseNotes);
const hasReleaseNotes = releaseNotes !== "";
if (!hasReleaseNotes) {
warn(
fail(
[
"This PR is missing release notes.",
"",
@@ -49,6 +50,19 @@ if (!hasReleaseNotes) {
'If the change is not user-facing for GPUI users, use "- [GPUI] N/A" for that entry.',
].join("\n"),
);
} else if (
entries.some((entry) => {
const description = entry.replace(/^-\s*(?:\[GPUI\]\s*)?/i, "").trim();
return description === "" || /^(?:N\/A\s+or\s+)?Added\/Fixed\/Improved\s*(?:\.{3}|…)$/i.test(description);
})
) {
fail(
[
"This PR has no proper release notes.",
"",
'Please replace them with "N/A" or a description of the changes.',
].join("\n"),
);
}
const GPUI_RELEASE_NOTES_PATTERN = /^- \[GPUI\]/im;
@@ -56,7 +70,7 @@ const GPUI_RELEASE_NOTES_PATTERN = /^- \[GPUI\]/im;
const gpuiCrates = danger.git.fileMatch("crates/gpui*/**");
if (gpuiCrates.edited || gpuiCrates.deleted) {
if (!releaseNotesEntries(releaseNotes).some((entry) => GPUI_RELEASE_NOTES_PATTERN.test(entry))) {
if (!entries.some((entry) => GPUI_RELEASE_NOTES_PATTERN.test(entry))) {
const { edited, deleted } = gpuiCrates.getKeyedPaths();
const touchedGpuiCratesStr = [...edited, ...deleted]
.map((file) => "`" + file.split("/")[1] + "`")
+1 -6
View File
@@ -14,12 +14,7 @@ function releaseNotesEntries(section) {
break;
}
entries.push(
...paragraph
.trimEnd()
.split(/\r?\n(?=- )/)
.map((entry) => entry.replace(/\r?\n/g, " ")),
);
entries.push(...paragraph.split(/\r?\n(?=- )/).map((entry) => entry.trimEnd().replace(/\r?\n/g, " ")));
}
return entries;
}