-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! fixup! fixup! fixup! Chore: Add E2E workflow Slack message tag
- Loading branch information
Showing
1 changed file
with
7 additions
and
85 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,92 +98,12 @@ jobs: | |
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Slack notification when failure on main (includes <!channel>) | ||
- name: Notify Slack (main) | ||
if: failure() && github.ref == 'refs/heads/main' | ||
id: slack-main | ||
uses: slackapi/[email protected] | ||
with: | ||
channel-id: ${{ secrets.SLACK_CHANNEL_ID }} | ||
payload: | | ||
{ | ||
"attachments": [ | ||
{ | ||
"color": "#ff0000", | ||
"blocks": [ | ||
{ | ||
"type": "header", | ||
"text": { | ||
"type": "plain_text", | ||
"text": ":boom: GitHub Action failed on the main branch!", | ||
"emoji": true | ||
} | ||
}, | ||
{ | ||
"type": "section", | ||
"text": { | ||
"type": "mrkdwn", | ||
"text": "Hey <!channel>, we have a failure on *main*!" | ||
} | ||
}, | ||
{ | ||
"type": "section", | ||
"text": { | ||
"type": "mrkdwn", | ||
"text": "*Pull request title:* `${{ github.event.pull_request.title }}`" | ||
} | ||
}, | ||
{ | ||
"type": "section", | ||
"text": { | ||
"type": "mrkdwn", | ||
"text": "*E2E tests result:* `${{ job.status }}`" | ||
} | ||
}, | ||
{ | ||
"type": "actions", | ||
"elements": [ | ||
{ | ||
"type": "button", | ||
"text": { | ||
"type": "plain_text", | ||
"text": ":github: Open Pull request" | ||
}, | ||
"url": "${{ github.event.pull_request.html_url }}" | ||
}, | ||
{ | ||
"type": "button", | ||
"text": { | ||
"type": "plain_text", | ||
"text": ":github: Open failed GitHub Action" | ||
}, | ||
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
}, | ||
{ | ||
"type": "button", | ||
"text": { | ||
"type": "plain_text", | ||
"text": ":github: Download Report" | ||
}, | ||
"url": "${{ steps.artifact-upload-step.outputs.artifact-url }}" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_NOTIFICATIONS_TOKEN }} # Webhook from Slack Application | ||
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | ||
|
||
# Slack notification when failure on other branches (no <!channel>) | ||
- name: Notify Slack (non-main) | ||
if: failure() && github.ref != 'refs/heads/main' | ||
id: slack-non-main | ||
- name: Notify Slack when failure | ||
id: Slack | ||
uses: slackapi/[email protected] | ||
if: failure() | ||
with: | ||
channel-id: ${{ secrets.SLACK_CHANNEL_ID }} | ||
channel-id: ${{ secrets.SLACK_CHANNEL_ID }} # Slack channel-id of #spirit-design-system-notifications_en | ||
payload: | | ||
{ | ||
"attachments": [ | ||
|
@@ -202,7 +122,9 @@ jobs: | |
"type": "section", | ||
"text": { | ||
"type": "mrkdwn", | ||
"text": "*Pull request title:* `${{ github.event.pull_request.title }}`" | ||
"text": "${{ github.ref == 'refs/heads/main' && 'Hey <!channel>:' || 'Hey everyone:' }} " + | ||
" E2E tests just failed on `${{ github.ref }}`!\n\n" + | ||
"*Pull request title:* `${{ github.event.pull_request.title }}`" | ||
} | ||
}, | ||
{ | ||
|