send notification on action failure (#3155)
<!-- PR description--> send a Slack notification if Github Actions fails #### Does this PR need a docs update or release note? - [ ] ⛔ No #### Type of change <!--- Please check the type of change your PR introduces: ---> - [ ] 🤖 Supportability/Tests #### Issue(s) #### Test Plan <!-- How will this be tested prior to merging.--> - [ ] 💪 Manual
This commit is contained in:
parent
6d022d196a
commit
372f1d5218
46
.github/workflows/sanity-test.yaml
vendored
46
.github/workflows/sanity-test.yaml
vendored
@ -55,7 +55,7 @@ jobs:
|
|||||||
|
|
||||||
# run the tests
|
# run the tests
|
||||||
- name: Version Test
|
- name: Version Test
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
if [ $( ./corso --version | grep 'Corso version:' | wc -l) -ne 1 ]
|
if [ $( ./corso --version | grep 'Corso version:' | wc -l) -ne 1 ]
|
||||||
then
|
then
|
||||||
@ -364,4 +364,46 @@ jobs:
|
|||||||
path: src/testlog/*
|
path: src/testlog/*
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
retention-days: 14
|
retention-days: 14
|
||||||
|
|
||||||
|
# run the tests
|
||||||
|
- name: SHA info
|
||||||
|
id: sha-info
|
||||||
|
if: failure()
|
||||||
|
run: |
|
||||||
|
echo ${GITHUB_REF#refs/heads/}-${GITHUB_SHA}
|
||||||
|
echo SHA=${GITHUB_REF#refs/heads/}-${GITHUB_SHA} >> $GITHUB_OUTPUT
|
||||||
|
echo RUN_URL=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} >> $GITHUB_OUTPUT
|
||||||
|
echo COMMIT_URL=${{ github.server_url }}/${{ github.repository }}/commit/${GITHUB_SHA} >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
|
||||||
|
- name: Send Github Action failure to Slack
|
||||||
|
id: slack-notification
|
||||||
|
if: failure()
|
||||||
|
uses: slackapi/slack-github-action@v1.23.0
|
||||||
|
with:
|
||||||
|
payload: |
|
||||||
|
{
|
||||||
|
"text": "GitHub Action build result: ${{ job.status }} on SHA: ${{ steps.sha-info.outputs.SHA }}",
|
||||||
|
"blocks": [
|
||||||
|
{
|
||||||
|
"type": "header",
|
||||||
|
"text": {
|
||||||
|
"type": "plain_text",
|
||||||
|
"text": "Failure in Sanity Test"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "divider"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "section",
|
||||||
|
"text": {
|
||||||
|
"type": "mrkdwn",
|
||||||
|
"text": "<${{ steps.sha-info.outputs.RUN_URL }}|Check logs> for <${{ steps.sha-info.outputs.COMMIT_URL }}|${{ steps.sha-info.outputs.SHA }}>"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
env:
|
||||||
|
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
||||||
|
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
|
||||||
Loading…
x
Reference in New Issue
Block a user