File tree Expand file tree Collapse file tree 2 files changed +30
-4
lines changed Expand file tree Collapse file tree 2 files changed +30
-4
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"template" : " ${{CHANGELOG}}" ,
3
- "pr_template" : " - ${{TITLE}}\n - PR: #${{NUMBER}}" ,
3
+ "pr_template" : " - ${{TITLE}} #${{NUMBER}}" ,
4
4
"empty_template" : " - no changes" ,
5
5
"categories" : [
6
6
{
Original file line number Diff line number Diff line change @@ -148,25 +148,51 @@ jobs:
148
148
env :
149
149
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
150
150
151
+ - name : Prepare Slack notification contents
152
+ if : startsWith(github.ref, 'refs/tags/v')
153
+ run : |
154
+ changelog=$(cat << EOH
155
+ ${{ steps.build_changelog.outputs.changelog }}
156
+ EOH
157
+ )
158
+ messageWithoutNewlines=$(echo "${changelog}" | awk '{printf "%s\\n", $0}')
159
+ messageWithoutDoubleQuotes=$(echo "${messageWithoutNewlines}" | sed "s/\"/'/g")
160
+ echo "${messageWithoutDoubleQuotes}"
161
+
162
+ echo "SLACK_CHANGELOG=${messageWithoutDoubleQuotes}" >> $GITHUB_ENV
163
+
151
164
- name : Post notification to Slack
152
165
153
166
if : startsWith(github.ref, 'refs/tags/v')
154
167
with :
155
168
channel-id : ${{ secrets.SLACK_CHANNEL_ID }}
156
169
payload : |
157
170
{
158
- "text": "New tag generated: ${{github.ref}}\nBuild result: ${{ job.status }}",
159
171
"blocks": [
172
+ {
173
+ "type": "header",
174
+ "text": {
175
+ "type": "plain_text",
176
+ "text": "New tag created",
177
+ "emoji": true
178
+ }
179
+ },
180
+ {
181
+ "type": "section",
182
+ "text": {
183
+ "type": "mrkdwn",
184
+ "text": "*Tag: ${{ github.ref_name }}*"
185
+ }
186
+ },
160
187
{
161
188
"type": "section",
162
189
"text": {
163
190
"type": "mrkdwn",
164
- "text": "New tag generated: ${{github.ref}}\nBuild result: ${{ job.status }}\nChangelog:\ n${{ steps.build_changelog.outputs.changelog }}"
191
+ "text": "*Changelog:*\ n${{ env.SLACK_CHANGELOG }}"
165
192
}
166
193
}
167
194
]
168
195
}
169
- slack-message : " "
170
196
env :
171
197
SLACK_BOT_TOKEN : ${{ secrets.SLACK_BOT_TOKEN }}
172
198
You can’t perform that action at this time.
0 commit comments