Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Update the dangerfile to check for issue links
Joseph T Lyons36a560dcd0dc
diff --git a/script/danger/dangerfile.ts b/script/danger/dangerfile.tsindex 110a630d1f7..8ff691774d0 100644--- a/script/danger/dangerfile.ts+++ b/script/danger/dangerfile.ts@@ -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"),+ );+}