Skip to content

Commit 4e703dc

Browse files
authored
Update slack-webhook.yaml
1 parent 350dcb6 commit 4e703dc

File tree

1 file changed

+27
-11
lines changed

1 file changed

+27
-11
lines changed
Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,28 @@
11
- name: Post a message in a channel
2-
uses: slackapi/[email protected]
3-
with:
4-
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
5-
webhook-type: incoming-webhook
6-
payload: |
7-
text: "*GitHub Action build result*: ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
8-
blocks:
9-
- type: "section"
10-
text:
11-
type: "mrkdwn"
12-
text: "GitHub Action build result: ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
workflow-event:
7+
required: true
8+
type: string
9+
secrets:
10+
slackWebhookUrl:
11+
required: true
12+
13+
jobs:
14+
notify:
15+
name: PR notification
16+
runs-on: [ubuntu-latest]
17+
steps:
18+
- name: Post message
19+
uses: slackapi/[email protected]
20+
env:
21+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
22+
with:
23+
payload: |
24+
{
25+
"title": ${{ toJson(fromJson(inputs.workflow-event).title) }},
26+
"author": ${{ toJson(fromJson(inputs.workflow-event).user.login) }},
27+
"link": ${{ toJson(fromJson(inputs.workflow-event).html_url) }}
28+
}

0 commit comments

Comments
 (0)