Skip to content

Commit ece948b

Browse files
Set up notifications for DevDocs Reviews
1 parent 26ec3f0 commit ece948b

File tree

1 file changed

+42
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)