Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Ping staging deployer in Slack notification #2053

Merged
merged 2 commits into from
Dec 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions .github/actions/staging-frontend-deploy/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ runs:
using: "composite"

steps:
- name: Set the Slack user
shell: python
run: |
import json
import os
mapping = json.loads("${{ toJSON(secrets.GH_SLACK_USERNAME_MAP) }}")
github_user = "${{ github.triggering_actor }}"
slack_id = mapping[github_user]
with open(os.getenv('GITHUB_ENV'), "a") as env_file:
env_file.write(f"SLACK_USER_ID={slack_id}")

- name: Notify deployment start
uses: slackapi/slack-github-action@v1.23.0
with:
Expand All @@ -34,7 +45,7 @@ runs:
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":spinning-cd: A deployment of staging-frontend is starting using the `${{ inputs.tag }}` tag."
"text": ":spinning-cd: A deployment of staging-frontend triggered by <@${{ env.SLACK_USER_ID }}> is starting using the `${{ inputs.tag }}` tag."
}
},
{
Expand Down Expand Up @@ -95,7 +106,7 @@ runs:
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":tadaco: The deployment of staging-frontend using the `${{ inputs.tag }}` tag *succeeded*."
"text": ":tadaco: The deployment of staging-frontend triggered by <@${{ env.SLACK_USER_ID }}> using the `${{ inputs.tag }}` tag *succeeded*."
}
},
{
Expand Down Expand Up @@ -123,7 +134,7 @@ runs:
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":alert: The deployment of staging-frontend using the `${{ inputs.tag }}` tag *failed* :alert:"
"text": ":alert: The deployment of staging-frontend triggered by <@${{ env.SLACK_USER_ID }}> using the `${{ inputs.tag }}` tag *failed* :alert:"
}
},
{
Expand Down