diff --git a/.github/workflows/sanity-test.yaml b/.github/workflows/sanity-test.yaml index daafd0321..59f7190fb 100644 --- a/.github/workflows/sanity-test.yaml +++ b/.github/workflows/sanity-test.yaml @@ -55,7 +55,7 @@ jobs: # run the tests - name: Version Test - run: | + run: | set -euo pipefail if [ $( ./corso --version | grep 'Corso version:' | wc -l) -ne 1 ] then @@ -364,4 +364,46 @@ jobs: path: src/testlog/* if-no-files-found: error retention-days: 14 - \ No newline at end of file + + # 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 \ No newline at end of file