-
Notifications
You must be signed in to change notification settings - Fork 9.2k
97 lines (89 loc) · 3.3 KB
/
pull_request_feed.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: Pull Request Feed
on:
pull_request_target:
types: [opened, closed]
permissions:
contents: read
env:
SLACK_WEBHOOK_URL: ${{ secrets.FEED_SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
PR_HTML_URL: ${{ github.event.pull_request.html_url }}
PR_TITLE: ${{ github.event.pull_request.title }}
jobs:
feed:
name: Slack Notifications
runs-on: ubuntu-latest
steps:
- name: Checkout Community Check
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
sparse-checkout: .github/actions/community_check
- name: Run Community Check
id: community_check
uses: ./.github/actions/community_check
with:
user_login: ${{ github.event.pull_request.user.login }}
maintainers: ${{ secrets.MAINTAINERS }}
partners: ${{ secrets.PARTNERS }}
- name: Pull Request Merged
if: github.event.pull_request.merged
uses: slackapi/slack-github-action@37ebaef184d7626c5f204ab8d3baff4262dd30f0 # v1.27.0
env:
MERGED_BY_URL: ${{ github.event.pull_request.merged_by.html_url }}
MERGED_BY_LOGIN: ${{ github.event.pull_request.merged_by.login }}
with:
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ${{ toJSON(format(':merged: <{0}|{1}> merged <{2}|{3}>', env.MERGED_BY_URL, env.MERGED_BY_LOGIN, env.PR_HTML_URL, env.PR_TITLE)) }}
}
}
]
}
- name: Maintainer Pull Request Opened
if: |
github.event.action == 'opened'
&& steps.community_check.outputs.maintainer == 'true'
&& github.actor != 'dependabot[bot]'
uses: slackapi/slack-github-action@37ebaef184d7626c5f204ab8d3baff4262dd30f0 # v1.27.0
env:
PR_AUTHOR_URL: ${{ github.event.pull_request.user.html_url }}
PR_AUTHOR_LOGIN: ${{ github.event.pull_request.user.login }}
with:
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ${{ toJSON(format(':open: <{0}|{1}> opened <{2}|{3}>', env.PR_AUTHOR_URL, env.PR_AUTHOR_LOGIN, env.PR_HTML_URL, env.PR_TITLE)) }}
}
}
]
}
- name: Partner Pull Request Opened
if: |
github.event.action == 'opened'
&& steps.community_check.outputs.partner == 'true'
uses: slackapi/slack-github-action@37ebaef184d7626c5f204ab8d3baff4262dd30f0 # v1.27.0
env:
PR_AUTHOR_URL: ${{ github.event.pull_request.user.html_url }}
PR_AUTHOR_LOGIN: ${{ github.event.pull_request.user.login }}
with:
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ${{ toJSON(format(':open: :aws: contributor <{0}|{1}> opened <{2}|{3}>', env.PR_AUTHOR_URL, env.PR_AUTHOR_LOGIN, env.PR_HTML_URL, env.PR_TITLE)) }}
}
}
]
}