Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Have Danger check the format of GitHub issue links (#14684)

Marshall Bowers8ef53aafa2d8
diff --git a/script/danger/dangerfile.ts b/script/danger/dangerfile.ts
index ced6e6eef71..a978b8977c4 100644
--- a/script/danger/dangerfile.ts
+++ b/script/danger/dangerfile.ts
@@ -33,3 +33,22 @@ if (!hasReleaseNotes) {
].join("\n"),
);
}
+
+const INCORRECT_ISSUE_LINK_PATTERN = new RegExp("-.*\\(#\\d+\\)", "g");
+
+const hasIncorrectIssueLinks = INCORRECT_ISSUE_LINK_PATTERN.test(
+ danger.github.pr.body,
+);
+if (hasIncorrectIssueLinks) {
+ warn(
+ [
+ "This PR has incorrectly formatted GitHub issue links in the release notes.",
+ "",
+ "GitHub issue links must be formatted as plain Markdown links:",
+ "",
+ "```",
+ "- Improved something ([#ISSUE](https://github.com/zed-industries/zed/issues/ISSUE)).",
+ "```",
+ ].join("\n"),
+ );
+}