File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -203,3 +203,39 @@ jobs:
203203 password : " ${{ secrets.PYPI_API_TOKEN }}"
204204 needs :
205205 - " unittest"
206+ slack-notify :
207+ needs :
208+ - " publish_gh"
209+ - " publish_pypi"
210+ name : " Send notification to the Slack"
211+ runs-on : " ubuntu-20.04"
212+ env :
213+ SLACK_WEBHOOK_URL : " ${{ secrets.SLACK_WEBHOOK_URL }}"
214+ SLACK_MESSAGE : >-
215+ *NOTIFICATION: NEW-RELEASE-PUBLISHED*\n
216+ Repository: <${{ github.server_url }}/${{ github.repository }}|${{ github.repository }}>\n
217+ Release: <${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ github.ref_name }}|${{ github.ref_name }}>\n
218+ Published by: <${{ github.server_url }}/${{ github.actor }}|${{ github.actor }}>
219+ steps :
220+ - name : " Send a notification to Slack"
221+ # ENVs cannot be used directly in job.if. This is a workaround to check
222+ # if SLACK_WEBHOOK_URL is present.
223+ if : " ${{ env.SLACK_WEBHOOK_URL != '' }}"
224+ uses : " slackapi/slack-github-action@v1.23.0"
225+ with :
226+ payload : |
227+ {
228+ "text": "${{ env.SLACK_MESSAGE }}",
229+ "blocks": [
230+ {
231+ "type": "section",
232+ "text": {
233+ "type": "mrkdwn",
234+ "text": "${{ env.SLACK_MESSAGE }}"
235+ }
236+ }
237+ ]
238+ }
239+ env :
240+ SLACK_WEBHOOK_URL : " ${{ secrets.SLACK_WEBHOOK_URL }}"
241+ SLACK_WEBHOOK_TYPE : " INCOMING_WEBHOOK"
You can’t perform that action at this time.
0 commit comments