Skip to content

Commit c0916bd

Browse files
Merge pull request #27 from mongodb/antoniomorello-DB-patch-1
Set up notifications for DevDocs Reviews
2 parents 26ec3f0 + 53a01e2 commit c0916bd

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Notify DevDocs on Reviews
2+
3+
on:
4+
pull_request_review_comment:
5+
types: [created, edited]
6+
pull_request:
7+
types: [opened, edited]
8+
pull_request_review:
9+
types: [submitted, edited]
10+
11+
jobs:
12+
notify:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Check for @DevDocs mention and send to Slack
16+
uses: actions/github-script@v7
17+
with:
18+
script: |
19+
const text = context.payload.comment?.body
20+
|| context.payload.issue?.body
21+
|| context.payload.pull_request?.body
22+
|| context.payload.review?.body
23+
|| "";
24+
25+
if (text.includes("@DevDocs") || text.includes("@10gen/devdocs")) {
26+
await fetch(process.env.SLACK_WEBHOOK_URL, {
27+
method: "POST",
28+
headers: { "Content-Type": "application/json" },
29+
body: JSON.stringify({
30+
text: `:eyes: @DevDocs has been mentioned in *${context.payload.repository.full_name}*
31+
Event: *${context.eventName}*
32+
Link: ${context.payload.comment?.html_url
33+
|| context.payload.issue?.html_url
34+
|| context.payload.pull_request?.html_url
35+
|| context.payload.review?.html_url}`
36+
}),
37+
});
38+
}
39+
env:
40+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

0 commit comments

Comments
 (0)