@@ -9,8 +9,10 @@ prHygiene({
});
const RELEASE_NOTES_PATTERN = new RegExp("Release Notes:\\r?\\n\\s+-", "gm");
+const body = danger.github.pr.body;
+
+const hasReleaseNotes = RELEASE_NOTES_PATTERN.test(body);
-const hasReleaseNotes = RELEASE_NOTES_PATTERN.test(danger.github.pr.body);
if (!hasReleaseNotes) {
warn(
[
@@ -33,3 +35,29 @@ if (!hasReleaseNotes) {
].join("\n"),
);
}
+
+const ISSUE_LINK_PATTERN = new RegExp(
+ "(?:^|\\s)(?:#(\\d+)|https:\\/\\/github\\.com\\/zed-industries\\/zed\\/issues\\/(\\d+))",
+ "g",
+);
+
+const includesIssueUrl = ISSUE_LINK_PATTERN.test(body);
+
+if (includesIssueUrl) {
+ const matches = body.match(ISSUE_LINK_PATTERN);
+ const issues = matches
+ .map((match) =>
+ match
+ .replace(/^#/, "")
+ .replace(/https:\/\/github\.com\/zed-industries\/zed\/issues\//, ""),
+ )
+ .filter((issue, index, self) => self.indexOf(issue) === index);
+
+ warn(
+ [
+ "This PR includes links to the following GitHub Issues: " +
+ issues.join(", "),
+ "If this pull requests aims to close an issue, please include a `Closes #ISSUE` line at the top of the PR body.",
+ ].join("\n"),
+ );
+}