mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
6c28b7e8b8
This PR sets up Danger to check PR titles for consistency, using [`danger-plugin-pr-hygiene`](https://github.com/maxdeviant/danger-plugin-pr-hygiene). <img width="919" alt="Screenshot 2024-06-14 at 11 16 31 AM" src="https://github.com/zed-industries/zed/assets/1486634/167fe698-2505-422b-8e41-e121d9fe933f"> Release Notes: - N/A
36 lines
963 B
TypeScript
36 lines
963 B
TypeScript
import { danger, warn } from "danger";
|
|
const { prHygiene } = require("danger-plugin-pr-hygiene");
|
|
|
|
prHygiene({
|
|
rules: {
|
|
// Don't enable this rule just yet, as it can have false positives.
|
|
useImperativeMood: "off",
|
|
},
|
|
});
|
|
|
|
const RELEASE_NOTES_PATTERN = new RegExp("Release Notes:\\r?\\n\\s+-", "gm");
|
|
|
|
const hasReleaseNotes = RELEASE_NOTES_PATTERN.test(danger.github.pr.body);
|
|
if (!hasReleaseNotes) {
|
|
warn(
|
|
[
|
|
"This PR is missing release notes.",
|
|
"",
|
|
'Please add a "Release Notes" section that describes the change:',
|
|
"",
|
|
"```",
|
|
"Release Notes:",
|
|
"",
|
|
"- (Added|Fixed|Improved) ... ([#<public_issue_number_if_exists>](https://github.com/zed-industries/zed/issues/<public_issue_number_if_exists>)).",
|
|
"```",
|
|
"",
|
|
'If your change is not user-facing, you can use "N/A" for the entry:',
|
|
"```",
|
|
"Release Notes:",
|
|
"",
|
|
"- N/A",
|
|
"```",
|
|
].join("\n"),
|
|
);
|
|
}
|