-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Send slack notification on failed GHA jobs (#346)
* Add slack notification to postmerge task failures * test if conditional * remove debug messages
- Loading branch information
1 parent
2b1b90b
commit 14cc993
Showing
3 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,3 +58,21 @@ jobs: | |
with: | ||
name: pr | ||
path: pr/ | ||
|
||
# If failures occur, notify in slack. | ||
- name: Notify Failure in Slack | ||
id: slack | ||
uses: slackapi/[email protected] | ||
if: ${{ failure() && github.ref == 'refs/heads/main' }} | ||
with: | ||
# This data can be any valid JSON from a previous step in the GitHub Action | ||
payload: | | ||
{ | ||
"message": "GitHub Action job failure on github.ref `${{ github.ref }}`", | ||
"pull_request": "${{ github.event.pull_request.html_url || github.event.head_commit.url }}", | ||
"workflow": "${{ github.workflow }}", | ||
"logs_url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
} | ||
env: | ||
PR_NUMBER: ${{ github.event.number }} | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,3 +25,21 @@ jobs: | |
branch=${raw/origin\/} | ||
fi | ||
cd ${{ github.workspace }}; tox -e test-gpu-postmerge -- $branch | ||
# If failures occur, notify in slack. | ||
- name: Notify Failure in Slack | ||
id: slack | ||
uses: slackapi/[email protected] | ||
if: ${{ failure() && github.ref == 'refs/heads/main' }} | ||
with: | ||
# This data can be any valid JSON from a previous step in the GitHub Action | ||
payload: | | ||
{ | ||
"message": "GitHub Action job failure on github.ref `${{ github.ref }}`", | ||
"pull_request": "${{ github.event.pull_request.html_url || github.event.head_commit.url }}", | ||
"workflow": "${{ github.workflow }}", | ||
"logs_url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
} | ||
env: | ||
PR_NUMBER: ${{ github.event.number }} | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |