From 93f9fce1152dc6b9e345847753e667e3db6dba5c Mon Sep 17 00:00:00 2001 From: Finn Evers Date: Tue, 15 Sep 2026 13:38:45 +0000 Subject: [PATCH] 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 --- script/danger/dangerfile.ts | 20 +++++++++++++++++--- script/lib/release-notes.js | 7 +------ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/script/danger/dangerfile.ts b/script/danger/dangerfile.ts index 56f9166b995..25ef35a9b9b 100644 --- a/script/danger/dangerfile.ts +++ b/script/danger/dangerfile.ts @@ -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] + "`") diff --git a/script/lib/release-notes.js b/script/lib/release-notes.js index caf5c75a8a2..9e88ada5243 100644 --- a/script/lib/release-notes.js +++ b/script/lib/release-notes.js @@ -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; }