-
Notifications
You must be signed in to change notification settings - Fork 11
32 lines (28 loc) · 1.02 KB
/
notify-slack.yml
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
name: Check pull request description checkbox and send notify to Slack
on:
pull_request:
types:
- closed
env:
checkbox: "should this be added to delinea marketplace?"
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
jobs:
notify:
runs-on: ubuntu-latest
steps:
- name: Check if "should this be added to delinea marketplace?" is checked
env:
BODY: ${{ github.event.pull_request.body }}
run: |
UNCHECKED="\[ \] $checkbox"
MARKED="\[x\] $checkbox"
if echo ${BODY,,} | grep -q "$MARKED"; then
curl -X POST -H 'Content-type: application/json' --data '{"text":"New PR: ${{ github.event.pull_request.title }}${{ github.event.pull_request.html_url }} by ${{ github.actor }}"}' "$SLACK_WEBHOOK_URL"
exit 0
elif echo ${BODY,,} | grep -q "$UNCHECKED"; then
echo "Checkbox is not checked"
exit 1
else
echo "Checkbox not found in pull request description"
exit 1
fi