Skip to content

Commit

Permalink
fixup! fixup! fixup! fixup! Chore: Add E2E workflow Slack message tag
Browse files Browse the repository at this point in the history
  • Loading branch information
crishpeen committed Jan 9, 2025
1 parent 97f9d93 commit f04ea3a
Showing 1 changed file with 7 additions and 85 deletions.
92 changes: 7 additions & 85 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -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 }}`"
}
},
{
Expand Down

0 comments on commit f04ea3a

Please sign in to comment.