Skip to content

Commit 99a2f0d

Browse files
Create slack-on-issue.yml workflow added
Send slack notifications to bunq staff on new issues
1 parent 25043a3 commit 99a2f0d

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

.github/workflows/slack-on-issue.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Notify Slack on New Issue or PR
2+
3+
on:
4+
issues:
5+
types: [opened]
6+
pull_request:
7+
types: [opened]
8+
9+
jobs:
10+
notify:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Send Slack notification
14+
run: |
15+
if [[ "${{ github.event_name }}" == "issues" ]]; then
16+
TYPE="Issue"
17+
TITLE="${{ github.event.issue.title }}"
18+
URL="${{ github.event.issue.html_url }}"
19+
USER="${{ github.event.issue.user.login }}"
20+
else
21+
TYPE="Pull Request"
22+
TITLE="${{ github.event.pull_request.title }}"
23+
URL="${{ github.event.pull_request.html_url }}"
24+
USER="${{ github.event.pull_request.user.login }}"
25+
fi
26+
27+
PAYLOAD=$(jq -n \
28+
--arg type "$TYPE" \
29+
--arg title "$TITLE" \
30+
--arg url "$URL" \
31+
--arg user "$USER" \
32+
'{
33+
text: "*New GitHub \($type)* :sparkles:",
34+
attachments: [
35+
{
36+
color: "#36a64f",
37+
title: $title,
38+
title_link: $url,
39+
fields: [
40+
{
41+
title: "Author",
42+
value: $user,
43+
short: true
44+
}
45+
]
46+
}
47+
]
48+
}')
49+
50+
curl -X POST -H 'Content-type: application/json' --data "$PAYLOAD" $SLACK_WEBHOOK_URL
51+
env:
52+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

0 commit comments

Comments
 (0)