-
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! Chore: Add E2E workflow Slack message tag
- Loading branch information
Showing
1 changed file
with
79 additions
and
6 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,12 +98,13 @@ jobs: | |
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Notify Slack when failure | ||
id: Slack | ||
# 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] | ||
if: failure() | ||
with: | ||
channel-id: ${{ secrets.SLACK_CHANNEL_ID }} # Slack channel-id of #spirit-design-system-notifications_en | ||
channel-id: ${{ secrets.SLACK_CHANNEL_ID }} | ||
payload: | | ||
{ | ||
"attachments": [ | ||
|
@@ -114,15 +115,87 @@ jobs: | |
"type": "header", | ||
"text": { | ||
"type": "plain_text", | ||
"text": ":boom: GitHub Action failed", | ||
"text": ":boom: GitHub Action failed on the main branch!", | ||
"emoji": true | ||
} | ||
}, | ||
{ | ||
"type": "section", | ||
"text": { | ||
"type": "mrkdwn", | ||
"text": "Hey <!channel>, we have a failure!" | ||
"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 | ||
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", | ||
"emoji": true | ||
} | ||
}, | ||
{ | ||
|