-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (74 loc) · 2.61 KB
/
pr-notifier.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Post PR to Slack
on:
pull_request:
types:
- opened
- ready_for_review
- reopened
- closed
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
jobs:
notify-on-open-pr:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false && (github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'ready_for_review')
steps:
- name: Post to slack
id: slack
uses: slackapi/slack-github-action@v1.25.0
with:
channel-id: ${{ vars.SLACK_CHANNEL_ID }}
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":large_yellow_circle: *${{ github.event.repository.name }}:* Pull request opened by ${{ github.event.pull_request.user.login }}\n<${{ github.event.pull_request.html_url }}>"
}
}
]
}
notify-on-merged-pr:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false && github.event.action == 'closed' && github.event.pull_request.merged == true
steps:
- name: Post to slack
id: slack
uses: slackapi/slack-github-action@v1.25.0
with:
channel-id: ${{ vars.SLACK_CHANNEL_ID }}
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":white_check_mark: *${{ github.event.repository.name }}:* Pull request merged\n<${{ github.event.pull_request.html_url }}>"
}
}
]
}
notify-on-closed-pr:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false && github.event.action == 'closed' && github.event.pull_request.merged == false
steps:
- name: Post to slack
id: slack
uses: slackapi/slack-github-action@v1.25.0
with:
channel-id: ${{ vars.SLACK_CHANNEL_ID }}
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":wastebasket: *${{ github.event.repository.name }}:* Pull request closed\n<${{ github.event.pull_request.html_url }}>"
}
}
]
}