Skip to content

Commit

Permalink
chore(ci): update slack message (#204)
Browse files Browse the repository at this point in the history
* chore(ci,release): update slack notification details
---------

Co-authored-by: saisatishkarra <[email protected]>
  • Loading branch information
pankajmouriyakong and saisatishkarra authored Jan 16, 2025
1 parent a5b1cfa commit 9629f9e
Show file tree
Hide file tree
Showing 2 changed files with 180 additions and 4 deletions.
96 changes: 94 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,53 @@ jobs:
with:
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL_NOTIFY_PUBLIC_SHARED_ACTIONS }}
status: success
success-message: ":white_check_mark: ${{ github.workflow }} workflow successfully ran within ${{ github.repository }}"
payload: |
{
"text": "Completely custom Slack message for CI",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"emoji": true,
"text": "CI Workflow Success"
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Repository:*\n<${{ github.server_url }}/${{ github.repository }}|${{ github.repository }}>"
},
{
"type": "mrkdwn",
"text": "*Branch:*\n<${{ github.server_url }}/${{ github.repository }}/tree/${{ github.ref_name }}|${{ github.ref_name }}>"
},
{
"type": "mrkdwn",
"text": "*Workflow Run:*\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.run_number }}>"
},
{
"type": "mrkdwn",
"text": "*TriggeredByCommit:*\n<${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}|${{ steps.slack-variables.outputs.short-commit-hash }}>"
},
{
"type": "mrkdwn",
"text": "*Triggered By:*\n${{ github.actor }}"
},
{
"type": "mrkdwn",
"text": "*Commit Author:*\n${{ github.event.head_commit.author.name }}"
},
{
"type": "mrkdwn",
"text": "*Event Name:*\n${{ github.event_name }}"
}
]
}
]
}
# Failure Notification
- name: Send Failure Slack alert
Expand All @@ -68,4 +114,50 @@ jobs:
with:
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL_ALERT_PUBLIC_SHARED_ACTIONS }}
status: failure
failure-message: ":x: This is a *failure* notification from ${{ github.repository }} for workflow ${{ github.workflow }}"
payload: |
{
"text": "Completely custom Slack message for CI",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"emoji": true,
"text": "CI Workflow Failure"
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Repository:*\n<${{ github.server_url }}/${{ github.repository }}|${{ github.repository }}>"
},
{
"type": "mrkdwn",
"text": "*Branch:*\n<${{ github.server_url }}/${{ github.repository }}/tree/${{ github.ref_name }}|${{ github.ref_name }}>"
},
{
"type": "mrkdwn",
"text": "*Workflow Run:*\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.run_number }}>"
},
{
"type": "mrkdwn",
"text": "*TriggeredByCommit:*\n<${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}|${{ steps.slack-variables.outputs.short-commit-hash }}>"
},
{
"type": "mrkdwn",
"text": "*Triggered By:*\n${{ github.actor }}"
},
{
"type": "mrkdwn",
"text": "*Commit Author:*\n${{ github.event.head_commit.author.name }}"
},
{
"type": "mrkdwn",
"text": "*Event Name:*\n${{ github.event_name }}"
}
]
}
]
}
88 changes: 86 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,49 @@ jobs:
with:
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL_NOTIFY_PUBLIC_SHARED_ACTIONS }}
status: success
success-message: ":white_check_mark: ${{ github.workflow }} workflow successfully ran within ${{ github.repository }}"
payload: |
{
"text": "Completely custom Slack message for release",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"emoji": true,
"text": "Release Workflow Success"
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Repository:*\n<${{ github.server_url }}/${{ github.repository }}|${{ github.repository }}>"
},
{
"type": "mrkdwn",
"text": "*Branch:*\n<${{ github.server_url }}/${{ github.repository }}/tree/${{ github.ref_name }}|${{ github.ref_name }}>"
},
{
"type": "mrkdwn",
"text": "*Workflow Run:*\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.run_number }}>"
},
{
"type": "mrkdwn",
"text": "*TriggeredByCommit:*\n<${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}|${{ github.sha }}>"
},
{
"type": "mrkdwn",
"text": "*Triggered By:*\n${{ github.actor }}"
},
{
"type": "mrkdwn",
"text": "*Event Name:*\n${{ github.event_name }}"
}
]
}
]
}
# Failure Notification
- name: Send Failure Notification
Expand All @@ -87,4 +129,46 @@ jobs:
with:
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL_ALERT_PUBLIC_SHARED_ACTIONS }}
status: failure
failure-message: ":x: This is a *failure* notification from ${{ github.repository }} for workflow ${{ github.workflow }}"
payload: |
{
"text": "Completely custom Slack message for release",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"emoji": true,
"text": "Release Workflow Failure"
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Repository:*\n<${{ github.server_url }}/${{ github.repository }}|${{ github.repository }}>"
},
{
"type": "mrkdwn",
"text": "*Branch:*\n<${{ github.server_url }}/${{ github.repository }}/tree/${{ github.ref_name }}|${{ github.ref_name }}>"
},
{
"type": "mrkdwn",
"text": "*Workflow Run:*\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.run_number }}>"
},
{
"type": "mrkdwn",
"text": "*TriggeredByCommit:*\n<${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}|${{ github.sha }}>"
},
{
"type": "mrkdwn",
"text": "*Triggered By:*\n${{ github.actor }}"
},
{
"type": "mrkdwn",
"text": "*Event Name:*\n${{ github.event_name }}"
}
]
}
]
}

0 comments on commit 9629f9e

Please sign in to comment.