forked from zed-industries/extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdangerfile.ts
More file actions
34 lines (29 loc) · 1.1 KB
/
dangerfile.ts
File metadata and controls
34 lines (29 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { danger, fail } 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 wasExtensionsTomlModified = danger.git.modified_files.some((file) =>
file.includes("extensions.toml"),
);
// Label to use when a PR does not update an extension.
const ALLOW_NO_EXTENSION_CHANGES_LABEL_NAME = "allow-no-extension";
const hasNoExtensionChangesLabel = danger.github.issue.labels.some(
(label) => label.name === ALLOW_NO_EXTENSION_CHANGES_LABEL_NAME,
);
if (!wasExtensionsTomlModified && !hasNoExtensionChangesLabel) {
fail(
[
"This PR doesn't include changes to `extensions.toml`.",
"",
"If you are creating a new extension, add a new entry to it.",
"",
"If you are updating an existing extension, update the version number in the corresponding entry.",
"",
"If your PR is not supposed to update or add an extension, state it explicitly and wait for a maintainer to add the `other` label.",
].join("\n"),
);
}