Skip to content

Commit 474489d

Browse files
committed
add slack action
1 parent dbcfa35 commit 474489d

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

‎.github/actions/slack/action.yml‎

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Notify Slack
2+
inputs:
3+
CHANNEL_ID:
4+
requires: true
5+
type: string
6+
MESSAGE:
7+
required: true
8+
type: string
9+
runs:
10+
using: "composite"
11+
steps:
12+
- uses: slackapi/slack-github-action@v1.27.0
13+
with:
14+
channel-id: ${{ inputs.CHANNEL_ID }}
15+
payload: |
16+
{
17+
"unfurl_links": false,
18+
"blocks": [
19+
{
20+
"type": "section",
21+
"text": {
22+
"type": "mrkdwn",
23+
"text": ${{ inputs.MESSAGE }}
24+
}
25+
},
26+
{
27+
"type": "section",
28+
"fields": [
29+
{
30+
"type": "mrkdwn",
31+
"text": "*Branch*\n<https://github.com/${{ github.repository }}/tree/${{ github.event.pull_request.head.ref }}|${{ github.repository }}@${{ github.event.pull_request.head.ref }}>"
32+
},
33+
{
34+
"type": "mrkdwn",
35+
"text": "*Author*\n<https://github.com/${{ github.event.pull_request.user.login }}|${{ github.event.pull_request.user.login }}>"
36+
},
37+
{
38+
"type": "mrkdwn",
39+
"text": "*PR*\n<https://github.com/${{ github.repository }}/pull/${{ github.event.number }}|${{ github.event.pull_request.title }}>"
40+
},
41+
{
42+
"type": "mrkdwn",
43+
"text": "*Build Logs*\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Logs>"
44+
}
45+
]
46+
}
47+
]
48+
}
49+
env:
50+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

0 commit comments

Comments
 (0)