Skip to content

Commit 6e1cacd

Browse files
author
sangeet-joy_xero
committed
updated the payload
1 parent 1e9744d commit 6e1cacd

File tree

2 files changed

+39
-42
lines changed

2 files changed

+39
-42
lines changed

.github/actions/notify-slack/action.yml

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,9 @@ inputs:
1717
job_url:
1818
required: false
1919
description: "job event link"
20-
repository_name:
21-
required: false
22-
description: "repo name"
23-
bot_token:
24-
required: false
25-
description: "slack app token"
26-
channel_id:
27-
required: false
28-
description: "channel id"
20+
button_type:
21+
required: false
22+
description: "color for the logs button"
2923

3024

3125
runs:
@@ -47,32 +41,46 @@ runs:
4741
env:
4842
SLACK_WEBHOOK_URL: ${{inputs.XERO_SLACK_WEBHOOK_URL}}
4943
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
50-
# SLACK_BOT_TOKEN: ${{inputs.bot_token}}
5144
with:
52-
# channel-id: ${{inputs.channel_id}}
5345
payload: |
5446
{
5547
"blocks": [
5648
{
57-
"type": "section",
58-
"text": {
59-
"type": "mrkdwn",
60-
"text": "**${{inputs.heading_text}}**"
61-
}
49+
"type": "rich_text",
50+
"elements": [
51+
{
52+
"type": "rich_text_section",
53+
"elements": [
54+
{
55+
"type": "text",
56+
"text": "${{inputs.heading_text}}",
57+
"style": {
58+
"bold": true
59+
}
60+
},
61+
{
62+
"type": "emoji",
63+
"name": "${{inputs.alert_type}}"
64+
}
65+
]
66+
}
67+
]
6268
},
6369
{
64-
"type": "section",
65-
"text": {
66-
"type": "mrkdwn",
67-
"text": "Job status: **${{ job.status }}**"
68-
}
70+
"type": "divider"
6971
},
70-
{
72+
{
7173
"type": "section",
72-
"text": {
73-
"type": "mrkdwn",
74-
"text": "PR: ${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
75-
}
74+
"fields": [
75+
{
76+
"type": "mrkdwn",
77+
"text": "*Repository:* \n ${{github.server_url}}/${{github.repository}}"
78+
},
79+
{
80+
"type": "mrkdwn",
81+
"text": "*Status:*\n ${{inputs.job_status}}"
82+
}
83+
]
7684
},
7785
{
7886
"type": "actions",
@@ -84,16 +92,8 @@ runs:
8492
"text": "Check the logs",
8593
"emoji": true
8694
},
95+
"style": "${{inputs.button_type}}",
8796
"url": "${{inputs.job_url}}"
88-
},
89-
{
90-
"type": "button",
91-
"text": {
92-
"type": "plain_text",
93-
"text": "github repo: ${{github.event.repository.name}}",
94-
"emoji": true
95-
},
96-
"url": "${{github.server_url}}/${{github.repository}}"
9797
}
9898
]
9999
}

.github/workflows/publish.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,11 @@ jobs:
5353
uses: ./xero-node/.github/actions/notify-slack
5454
with:
5555
heading_text: "Publish job has succeeded !"
56-
alert_type: "good"
56+
alert_type: "thumbsup"
5757
job_status: ${{job.status}}
5858
XERO_SLACK_WEBHOOK_URL: ${{secrets.XERO_SLACK_WEBHOOK_URL}}
5959
job_url: "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}"
60-
# bot_token: ${{secrets.XERO_SLACK_BOT_TOKEN}}
61-
channel_id: 'C07S29J583U'
60+
button_type: "primary"
6261

6362
notify-slack-on-failure:
6463
runs-on: ubuntu-latest
@@ -75,10 +74,8 @@ jobs:
7574
uses: ./xero-node/.github/actions/notify-slack
7675
with:
7776
heading_text: "Publish job has failed !"
78-
alert_type: "danger"
77+
alert_type: "alert"
7978
job_status: ${{job.status}}
8079
XERO_SLACK_WEBHOOK_URL: ${{secrets.XERO_SLACK_WEBHOOK_URL}}
8180
job_url: "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}"
82-
repository_name: ${{github.repository}}
83-
# bot_token: ${{secrets.SLACK_BOT_TOKEN}}
84-
channel_id: 'C07S29J583U'
81+
button_type: "danger"

0 commit comments

Comments
 (0)