-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
dangerfile-greeting.ts
33 lines (27 loc) · 1012 Bytes
/
dangerfile-greeting.ts
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
import { danger, schedule } from "danger";
schedule(async () => {
const { owner, repo, number } = danger.github.thisPR;
const { data: comments } = await danger.github.api.issues.listComments({
issue_number: number,
repo,
owner,
});
const hasGreetingComment = comments.some((comment) =>
comment.body.includes("id: greetingComment")
);
if (!hasGreetingComment) {
await danger.github.api.issues.createComment({
repo,
owner,
issue_number: number,
body: `<!-- id: greetingComment -->
Hello @${danger.github.pr.user.login},
thank you very much for creating a Pull Request!
Here is a small checklist to get this PR merged as quickly as possible:
- [ ] Do all subcommands / options which take arguments include the \`args\` property (\`args: {}\`)?
- [ ] Are all options modular? E.g. \`-a\` \`-u\` \`-x\` instead of \`-aux\`
- [ ] Have all other checks passed?
Please add a 👍 as a reaction to this comment to show that you read this.`,
});
}
});