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

Commit

Permalink
Ping staging deployer in Slack notification (#2053)
Browse files Browse the repository at this point in the history
  • Loading branch information
krysal committed Dec 19, 2022
1 parent ca02c8b commit 7139171
Showing 1 changed file with 14 additions and 3 deletions.
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

0 comments on commit 7139171

Please sign in to comment.