-
Notifications
You must be signed in to change notification settings - Fork 6
38 lines (35 loc) · 1.32 KB
/
devdocs-notify.yml
File metadata and controls
38 lines (35 loc) · 1.32 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
35
36
37
38
name: DevDocs PR or Issue Creation Notifier
on:
issues:
types: [opened]
pull_request_target:
types: [opened]
jobs:
notify:
runs-on: ubuntu-latest
steps:
- name: Check for new PR or issues
uses: actions/github-script@v7
with:
script: |
const text = context.payload.comment?.body
|| context.payload.issue?.body
|| context.payload.pull_request?.body
|| context.payload.review?.body
|| "";
const url = process.env.SLACK_WEBHOOK_URL;
console.log("Slack URL Length", url?.length);
await fetch(process.env.SLACK_WEBHOOK_URL, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
text: `:eyes: @DevDocs a PR was opened or issue created in *${context.payload.repository.full_name}*
Event: *${context.eventName}*
Link: ${context.payload.comment?.html_url
|| context.payload.issue?.html_url
|| context.payload.pull_request?.html_url
|| context.payload.review?.html_url}`
}),
});
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}