mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-19 06:59:22 +01:00
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:
@@ -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] + "`")
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user