From b27785a4e3fe9d55f88fd15b76362632ff62e716 Mon Sep 17 00:00:00 2001 From: kb-typeform Date: Tue, 24 Mar 2026 14:48:11 +0100 Subject: [PATCH 1/5] ci(NOJIRA-1234): align frontend deploy notifications with backend format --- .../workflows/frontend-deploy-workflow.yml | 6 +- .../slack-deployment-notification/action.yml | 168 ++---------------- 2 files changed, 18 insertions(+), 156 deletions(-) diff --git a/.github/workflows/frontend-deploy-workflow.yml b/.github/workflows/frontend-deploy-workflow.yml index 3586cf1..73457ec 100644 --- a/.github/workflows/frontend-deploy-workflow.yml +++ b/.github/workflows/frontend-deploy-workflow.yml @@ -249,6 +249,10 @@ on: description: 'Slack channel for deployment notifications (e.g., tfprod-deploy)' type: string default: 'poc-tfprod-admin-deploy' + team-slack-handle: + description: 'Team Slack handle to mention on deploy failure (e.g., @tech-frontend). Leave empty to skip.' + type: string + default: '' secrets: GH_TOKEN: @@ -677,8 +681,8 @@ jobs: cdn-url: ${{ inputs.cdn-url }} github-sha: ${{ github.sha }} github-actor: ${{ github.actor }} - github-ref-name: ${{ github.ref_name }} github-repository: ${{ github.repository }} github-server-url: ${{ github.server_url }} github-run-id: ${{ github.run_id }} + team-slack-handle: ${{ inputs.team-slack-handle }} SLACK_BOT_TOKEN: ${{ secrets.SLACK_OAUTH_TOKEN }} diff --git a/shared-actions/slack-deployment-notification/action.yml b/shared-actions/slack-deployment-notification/action.yml index 78a8fd5..2e8d570 100644 --- a/shared-actions/slack-deployment-notification/action.yml +++ b/shared-actions/slack-deployment-notification/action.yml @@ -1,5 +1,5 @@ name: 'Slack Deployment Notification' -description: 'Send deployment success or failure notifications to Slack with detailed information' +description: 'Send deployment success or failure notifications to Slack, matching the backend deploy message format used in #tfprod-deploy' inputs: slack-channel: description: 'Slack channel ID for notifications (e.g., tfprod-deploy)' @@ -11,17 +11,15 @@ inputs: description: 'Deployment status: success or failure' required: true cdn-url: - description: 'Public CDN URL for the deployed application' - required: true + description: 'Public CDN URL for the deployed application (included in success messages)' + required: false + default: '' github-sha: description: 'Git commit SHA' required: true github-actor: description: 'GitHub user who triggered the deployment' required: true - github-ref-name: - description: 'Git branch or tag name' - required: true github-repository: description: 'Repository name (owner/repo)' required: true @@ -31,6 +29,10 @@ inputs: github-run-id: description: 'GitHub Actions run ID' required: true + team-slack-handle: + description: 'Team Slack handle to mention on failure (e.g., @tech-frontend). Leave empty to skip team mention.' + required: false + default: '' SLACK_BOT_TOKEN: description: 'Slack OAuth token for posting messages' required: true @@ -38,21 +40,12 @@ inputs: runs: using: 'composite' steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - - name: Get commit message + - name: Prepare short SHA id: commit shell: bash run: | - COMMIT_MSG=$(git log -1 --pretty=%B ${{ inputs.github-sha }} 2>/dev/null || echo "Commit message unavailable") - # Truncate to 100 chars and escape for JSON - COMMIT_MSG=$(echo "$COMMIT_MSG" | head -c 100 | sed 's/"/\\"/g' | tr -d '\n') - echo "message=$COMMIT_MSG" >> $GITHUB_OUTPUT echo "short_sha=$(echo ${{ inputs.github-sha }} | cut -c1-7)" >> $GITHUB_OUTPUT - + - name: Send success notification if: ${{ inputs.deployment-status == 'success' }} uses: slackapi/slack-github-action@v1.27.0 @@ -60,78 +53,11 @@ runs: channel-id: ${{ inputs.slack-channel }} payload: | { - "text": "✅ Deployment Successful: ${{ inputs.app-name }}", - "blocks": [ - { - "type": "header", - "text": { - "type": "plain_text", - "text": "✅ Deployment Successful", - "emoji": true - } - }, - { - "type": "section", - "fields": [ - { - "type": "mrkdwn", - "text": "*App:*\n${{ inputs.app-name }}" - }, - { - "type": "mrkdwn", - "text": "*Environment:*\nProduction" - }, - { - "type": "mrkdwn", - "text": "*CDN:*\n<${{ inputs.cdn-url }}|${{ inputs.cdn-url }}>" - }, - { - "type": "mrkdwn", - "text": "*Deployed by:*\n${{ inputs.github-actor }}" - }, - { - "type": "mrkdwn", - "text": "*Commit:*\n<${{ inputs.github-server-url }}/${{ inputs.github-repository }}/commit/${{ inputs.github-sha }}|${{ steps.commit.outputs.short_sha }}>" - }, - { - "type": "mrkdwn", - "text": "*Branch:*\n${{ inputs.github-ref-name }}" - } - ] - }, - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "*Commit Message:*\n${{ steps.commit.outputs.message }}" - } - }, - { - "type": "actions", - "elements": [ - { - "type": "button", - "text": { - "type": "plain_text", - "text": "View Workflow" - }, - "url": "${{ inputs.github-server-url }}/${{ inputs.github-repository }}/actions/runs/${{ inputs.github-run-id }}" - }, - { - "type": "button", - "text": { - "type": "plain_text", - "text": "View Commit" - }, - "url": "${{ inputs.github-server-url }}/${{ inputs.github-repository }}/commit/${{ inputs.github-sha }}" - } - ] - } - ] + "text": "🚀 `${{ inputs.app-name }}:${{ steps.commit.outputs.short_sha }}` was deployed to production by *${{ inputs.github-actor }}*${{ inputs.cdn-url != '' && format(' (<{0}|CDN>)', inputs.cdn-url) || '' }}" } env: SLACK_BOT_TOKEN: ${{ inputs.SLACK_BOT_TOKEN }} - + - name: Send failure notification if: ${{ inputs.deployment-status == 'failure' }} uses: slackapi/slack-github-action@v1.27.0 @@ -139,75 +65,7 @@ runs: channel-id: ${{ inputs.slack-channel }} payload: | { - "text": "❌ Deployment Failed: ${{ inputs.app-name }}", - "blocks": [ - { - "type": "header", - "text": { - "type": "plain_text", - "text": "❌ Deployment Failed", - "emoji": true - } - }, - { - "type": "section", - "fields": [ - { - "type": "mrkdwn", - "text": "*App:*\n${{ inputs.app-name }}" - }, - { - "type": "mrkdwn", - "text": "*Environment:*\nProduction" - }, - { - "type": "mrkdwn", - "text": "*Failed at:*\nDeploy job" - }, - { - "type": "mrkdwn", - "text": "*Deployed by:*\n${{ inputs.github-actor }}" - }, - { - "type": "mrkdwn", - "text": "*Commit:*\n<${{ inputs.github-server-url }}/${{ inputs.github-repository }}/commit/${{ inputs.github-sha }}|${{ steps.commit.outputs.short_sha }}>" - }, - { - "type": "mrkdwn", - "text": "*Branch:*\n${{ inputs.github-ref-name }}" - } - ] - }, - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": ":warning: *Action Required:* Check the workflow logs for details." - } - }, - { - "type": "actions", - "elements": [ - { - "type": "button", - "text": { - "type": "plain_text", - "text": "View Logs" - }, - "url": "${{ inputs.github-server-url }}/${{ inputs.github-repository }}/actions/runs/${{ inputs.github-run-id }}", - "style": "danger" - }, - { - "type": "button", - "text": { - "type": "plain_text", - "text": "View Commit" - }, - "url": "${{ inputs.github-server-url }}/${{ inputs.github-repository }}/commit/${{ inputs.github-sha }}" - } - ] - } - ] + "text": "🔥 The deployment of `${{ inputs.app-name }}:${{ steps.commit.outputs.short_sha }}` to production by *${{ inputs.github-actor }}* has failed (<${{ inputs.github-server-url }}/${{ inputs.github-repository }}/actions/runs/${{ inputs.github-run-id }}|logs>)${{ inputs.team-slack-handle != '' && format(' {0}', inputs.team-slack-handle) || '' }}" } env: SLACK_BOT_TOKEN: ${{ inputs.SLACK_BOT_TOKEN }} From 10930842a63283d0ab6edf26a149d9a2f6594347 Mon Sep 17 00:00:00 2001 From: kb-typeform Date: Tue, 24 Mar 2026 15:01:11 +0100 Subject: [PATCH 2/5] ci: point action ref to branch for testing --- .github/workflows/frontend-deploy-workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/frontend-deploy-workflow.yml b/.github/workflows/frontend-deploy-workflow.yml index 73457ec..02bcd93 100644 --- a/.github/workflows/frontend-deploy-workflow.yml +++ b/.github/workflows/frontend-deploy-workflow.yml @@ -673,7 +673,7 @@ jobs: steps: - name: Send deployment notification - uses: Typeform/.github/shared-actions/slack-deployment-notification@v1 + uses: Typeform/.github/shared-actions/slack-deployment-notification@feat/align-frontend-deploy-notifications with: slack-channel: ${{ inputs.slack-channel }} app-name: ${{ inputs.app-name }} From 45a1c4624d41585dbe1aba77734b3857dcf035c9 Mon Sep 17 00:00:00 2001 From: kb-typeform Date: Tue, 24 Mar 2026 15:16:06 +0100 Subject: [PATCH 3/5] fix: remove CDN link, add [frontend] tag, build messages in shell --- .../workflows/frontend-deploy-workflow.yml | 1 - .../slack-deployment-notification/action.yml | 30 +++++++++++++------ 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/.github/workflows/frontend-deploy-workflow.yml b/.github/workflows/frontend-deploy-workflow.yml index 02bcd93..e82ca4d 100644 --- a/.github/workflows/frontend-deploy-workflow.yml +++ b/.github/workflows/frontend-deploy-workflow.yml @@ -678,7 +678,6 @@ jobs: slack-channel: ${{ inputs.slack-channel }} app-name: ${{ inputs.app-name }} deployment-status: ${{ needs.deploy.result }} - cdn-url: ${{ inputs.cdn-url }} github-sha: ${{ github.sha }} github-actor: ${{ github.actor }} github-repository: ${{ github.repository }} diff --git a/shared-actions/slack-deployment-notification/action.yml b/shared-actions/slack-deployment-notification/action.yml index 2e8d570..d1c9bbc 100644 --- a/shared-actions/slack-deployment-notification/action.yml +++ b/shared-actions/slack-deployment-notification/action.yml @@ -10,10 +10,6 @@ inputs: deployment-status: description: 'Deployment status: success or failure' required: true - cdn-url: - description: 'Public CDN URL for the deployed application (included in success messages)' - required: false - default: '' github-sha: description: 'Git commit SHA' required: true @@ -40,11 +36,27 @@ inputs: runs: using: 'composite' steps: - - name: Prepare short SHA - id: commit + - name: Build notification message + id: msg shell: bash run: | - echo "short_sha=$(echo ${{ inputs.github-sha }} | cut -c1-7)" >> $GITHUB_OUTPUT + SHORT_SHA=$(echo "${{ inputs.github-sha }}" | cut -c1-7) + APP="${{ inputs.app-name }}" + ACTOR="${{ inputs.github-actor }}" + WORKFLOW_URL="${{ inputs.github-server-url }}/${{ inputs.github-repository }}/actions/runs/${{ inputs.github-run-id }}" + TEAM="${{ inputs.team-slack-handle }}" + + # Success: 🚀 [frontend] `app:sha` was deployed to production by *actor* + SUCCESS_MSG="🚀 [frontend] \`${APP}:${SHORT_SHA}\` was deployed to production by *${ACTOR}*" + + # Failure: 🔥 [frontend] The deployment of `app:sha` to production by *actor* has failed () @team + FAILURE_MSG="🔥 [frontend] The deployment of \`${APP}:${SHORT_SHA}\` to production by *${ACTOR}* has failed (<${WORKFLOW_URL}|logs>)" + if [ -n "$TEAM" ]; then + FAILURE_MSG="${FAILURE_MSG} ${TEAM}" + fi + + echo "success_msg=${SUCCESS_MSG}" >> $GITHUB_OUTPUT + echo "failure_msg=${FAILURE_MSG}" >> $GITHUB_OUTPUT - name: Send success notification if: ${{ inputs.deployment-status == 'success' }} @@ -53,7 +65,7 @@ runs: channel-id: ${{ inputs.slack-channel }} payload: | { - "text": "🚀 `${{ inputs.app-name }}:${{ steps.commit.outputs.short_sha }}` was deployed to production by *${{ inputs.github-actor }}*${{ inputs.cdn-url != '' && format(' (<{0}|CDN>)', inputs.cdn-url) || '' }}" + "text": "${{ steps.msg.outputs.success_msg }}" } env: SLACK_BOT_TOKEN: ${{ inputs.SLACK_BOT_TOKEN }} @@ -65,7 +77,7 @@ runs: channel-id: ${{ inputs.slack-channel }} payload: | { - "text": "🔥 The deployment of `${{ inputs.app-name }}:${{ steps.commit.outputs.short_sha }}` to production by *${{ inputs.github-actor }}* has failed (<${{ inputs.github-server-url }}/${{ inputs.github-repository }}/actions/runs/${{ inputs.github-run-id }}|logs>)${{ inputs.team-slack-handle != '' && format(' {0}', inputs.team-slack-handle) || '' }}" + "text": "${{ steps.msg.outputs.failure_msg }}" } env: SLACK_BOT_TOKEN: ${{ inputs.SLACK_BOT_TOKEN }} From dff926d0e5823d712b2eb22a9f8cd3248935255b Mon Sep 17 00:00:00 2001 From: kb-typeform Date: Tue, 24 Mar 2026 15:35:36 +0100 Subject: [PATCH 4/5] chore: revert action ref back to @v1 for merge --- .github/workflows/frontend-deploy-workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/frontend-deploy-workflow.yml b/.github/workflows/frontend-deploy-workflow.yml index e82ca4d..53cc755 100644 --- a/.github/workflows/frontend-deploy-workflow.yml +++ b/.github/workflows/frontend-deploy-workflow.yml @@ -673,7 +673,7 @@ jobs: steps: - name: Send deployment notification - uses: Typeform/.github/shared-actions/slack-deployment-notification@feat/align-frontend-deploy-notifications + uses: Typeform/.github/shared-actions/slack-deployment-notification@v1 with: slack-channel: ${{ inputs.slack-channel }} app-name: ${{ inputs.app-name }} From fb867a3f21ee4123e648b5a7aa6b7a06c271809b Mon Sep 17 00:00:00 2001 From: kb-typeform Date: Tue, 24 Mar 2026 15:42:35 +0100 Subject: [PATCH 5/5] feat: override bot display name to 'Deploy Notifier', point to branch for testing --- .github/workflows/frontend-deploy-workflow.yml | 2 +- shared-actions/slack-deployment-notification/action.yml | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/frontend-deploy-workflow.yml b/.github/workflows/frontend-deploy-workflow.yml index 53cc755..e82ca4d 100644 --- a/.github/workflows/frontend-deploy-workflow.yml +++ b/.github/workflows/frontend-deploy-workflow.yml @@ -673,7 +673,7 @@ jobs: steps: - name: Send deployment notification - uses: Typeform/.github/shared-actions/slack-deployment-notification@v1 + uses: Typeform/.github/shared-actions/slack-deployment-notification@feat/align-frontend-deploy-notifications with: slack-channel: ${{ inputs.slack-channel }} app-name: ${{ inputs.app-name }} diff --git a/shared-actions/slack-deployment-notification/action.yml b/shared-actions/slack-deployment-notification/action.yml index d1c9bbc..b3506ec 100644 --- a/shared-actions/slack-deployment-notification/action.yml +++ b/shared-actions/slack-deployment-notification/action.yml @@ -65,7 +65,8 @@ runs: channel-id: ${{ inputs.slack-channel }} payload: | { - "text": "${{ steps.msg.outputs.success_msg }}" + "text": "${{ steps.msg.outputs.success_msg }}", + "username": "Deploy Notifier" } env: SLACK_BOT_TOKEN: ${{ inputs.SLACK_BOT_TOKEN }} @@ -77,7 +78,8 @@ runs: channel-id: ${{ inputs.slack-channel }} payload: | { - "text": "${{ steps.msg.outputs.failure_msg }}" + "text": "${{ steps.msg.outputs.failure_msg }}", + "username": "Deploy Notifier" } env: SLACK_BOT_TOKEN: ${{ inputs.SLACK_BOT_TOKEN }}