dangerfile.ts

 1import { danger, warn } from "danger";
 2const { prHygiene } = require("danger-plugin-pr-hygiene");
 3
 4prHygiene({
 5  rules: {
 6    // Don't enable this rule just yet, as it can have false positives.
 7    useImperativeMood: "off",
 8  },
 9});
10
11const RELEASE_NOTES_PATTERN = new RegExp("Release Notes:\\r?\\n\\s+-", "gm");
12
13const hasReleaseNotes = RELEASE_NOTES_PATTERN.test(danger.github.pr.body);
14if (!hasReleaseNotes) {
15  warn(
16    [
17      "This PR is missing release notes.",
18      "",
19      'Please add a "Release Notes" section that describes the change:',
20      "",
21      "```",
22      "Release Notes:",
23      "",
24      "- (Added|Fixed|Improved) ... ([#<public_issue_number_if_exists>](https://github.com/zed-industries/zed/issues/<public_issue_number_if_exists>)).",
25      "```",
26      "",
27      'If your change is not user-facing, you can use "N/A" for the entry:',
28      "```",
29      "Release Notes:",
30      "",
31      "- N/A",
32      "```",
33    ].join("\n"),
34  );
35}