@@ -13,6 +13,10 @@ inputs:
13
13
channel :
14
14
description : The Slack channel name for receiving the notification
15
15
required : true
16
+ slack-ts :
17
+ description : The timestamp of the message to update
18
+ required : false
19
+ default : ' '
16
20
status :
17
21
description : Customize the notification status to be "success", "failure" or a custom value.
18
22
required : false
@@ -68,44 +72,51 @@ runs:
68
72
69
73
- name : Send notification
70
74
if : always()
71
-
72
- env :
73
- SLACK_BOT_TOKEN : ${{ inputs.token }}
75
+
74
76
with :
75
- channel-id : ${{ inputs.channel }}
76
- payload : |
77
- {
78
- "text": ":${{ steps.fields.outputs.emoji }}: *Workflow <https://github.com/${{ inputs.repository }}/actions/runs/${{ github.run_id }}/|${{ github.workflow }}> ${{ inputs.status }}*",
79
- "attachments": [
80
- {
81
- "color": "${{ steps.fields.outputs.color }}",
82
- "fields": [
83
- {
84
- "title": "Repository",
85
- "value": "<https://github.com/${{ inputs.repository }}|${{ inputs.repository }}>",
86
- "short": true
87
- },
88
- {
89
- "title": "Environment/Branch",
90
- "value": "${{ inputs.environment || github.ref_name }}",
91
- "short": true
92
- },
93
- {
94
- "title": "Author",
95
- "value": "<https://github.com/${{ steps.fields.outputs.author }}|${{ steps.fields.outputs.author }}>",
96
- "short": true
97
- },
98
- {
99
- "title": "Job",
100
- "value": "${{ github.job }}",
101
- "short": true
102
- },
103
- {
104
- "title": "Commit Message",
105
- "value": ${{ toJSON(steps.fields.outputs.message) }},
106
- "short": false
107
- }
108
- ]
77
+ slack-channel : ${{ inputs.channel }}
78
+ slack-bot-user-oauth-access-token : ${{ inputs.token }}
79
+ slack-optional-thread_ts : ${{ inputs.slack-ts }}
80
+ slack-blocks : >-
81
+ [
82
+ {
83
+ "type": "section",
84
+ "text": {
85
+ "type": "mrkdwn",
86
+ "text": ":${{ steps.fields.outputs.emoji }}: *Workflow <https://github.com/${{ inputs.repository }}/actions/runs/${{ github.run_id }}/|${{ github.workflow }}> ${{ inputs.status }}*"
87
+ }
88
+ },
89
+ {
90
+ "type": "section",
91
+ "fields": [
92
+ {
93
+ "type": "mrkdwn",
94
+ "text": "*Repository*\n<https://github.com/${{ inputs.repository }}|${{ inputs.repository }}>"
95
+ },
96
+ {
97
+ "type": "mrkdwn",
98
+ "text": "*Environment/Branch*\n${{ inputs.environment || github.ref_name }}"
99
+ }
100
+ ]
101
+ },
102
+ {
103
+ "type": "section",
104
+ "fields": [
105
+ {
106
+ "type": "mrkdwn",
107
+ "text": "*Author*\n<https://github.com/${{ steps.fields.outputs.author }}|${{ steps.fields.outputs.author }}>"
108
+ },
109
+ {
110
+ "type": "mrkdwn",
111
+ "text": "*Job*\n${{ github.job }}"
112
+ }
113
+ ]
114
+ },
115
+ {
116
+ "type": "section",
117
+ "text": {
118
+ "type": "mrkdwn",
119
+ "text": "*Commit Message*\n${{ steps.fields.outputs.message }}"
109
120
}
110
- ]
111
- }
121
+ }
122
+ ]
0 commit comments