File tree Expand file tree Collapse file tree 1 file changed +37
-1
lines changed Expand file tree Collapse file tree 1 file changed +37
-1
lines changed Original file line number Diff line number Diff line change 1
1
---
2
2
name : " CI"
3
- on :
3
+ on : # yamllint disable-line rule:truthy
4
4
- " push"
5
5
- " pull_request"
6
6
jobs :
@@ -170,3 +170,39 @@ jobs:
170
170
password : " ${{ secrets.PYPI_API_TOKEN }}"
171
171
needs :
172
172
- " unittest"
173
+ slack-notify :
174
+ needs :
175
+ - " publish_gh"
176
+ - " publish_pypi"
177
+ name : " Send notification to the Slack"
178
+ runs-on : " ubuntu-20.04"
179
+ env :
180
+ SLACK_WEBHOOK_URL : " ${{ secrets.SLACK_WEBHOOK_URL }}"
181
+ SLACK_MESSAGE : >-
182
+ *NOTIFICATION: NEW-RELEASE-PUBLISHED*\n
183
+ Repository: <${{ github.server_url }}/${{ github.repository }}|${{ github.repository }}>\n
184
+ Release: <${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ github.ref_name }}|${{ github.ref_name }}>\n
185
+ Published by: <${{ github.server_url }}/${{ github.actor }}|${{ github.actor }}>
186
+ steps :
187
+ - name : " Send a notification to Slack"
188
+ # ENVs cannot be used directly in job.if. This is a workaround to check
189
+ # if SLACK_WEBHOOK_URL is present.
190
+ if : " ${{ env.SLACK_WEBHOOK_URL != '' }}"
191
+ uses :
" slackapi/[email protected] "
192
+ with :
193
+ payload : |
194
+ {
195
+ "text": "${{ env.SLACK_MESSAGE }}",
196
+ "blocks": [
197
+ {
198
+ "type": "section",
199
+ "text": {
200
+ "type": "mrkdwn",
201
+ "text": "${{ env.SLACK_MESSAGE }}"
202
+ }
203
+ }
204
+ ]
205
+ }
206
+ env :
207
+ SLACK_WEBHOOK_URL : " ${{ secrets.SLACK_WEBHOOK_URL }}"
208
+ SLACK_WEBHOOK_TYPE : " INCOMING_WEBHOOK"
You can’t perform that action at this time.
0 commit comments