Skip to content

Commit

Permalink
[BRE-265] Updating slack tag and commit hash to links
Browse files Browse the repository at this point in the history
  • Loading branch information
pixman20 committed Nov 4, 2024
1 parent 2759b6e commit 4dbc62d
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions report-deployment-status-to-slack/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,36 +68,46 @@ runs:
local url="${{ inputs.url }}"
local commit_sha="${{ inputs.commit-sha }}"
local base_url="https://github.com"
local github_org="bitwarden"
local commit_url="$base_url/$github_org/$project/commit/$commit_sha"
local tag_url="$base_url/$github_org/$project/tree/$tag"
# Slack link format: https://api.slack.com/reference/surfaces/formatting
local commit_link="<$commit_url|$commit_sha>"
local tag_link="<$tag_url|$tag>"
case $event in
start)
SLACK_MESSAGE=":loading: Deploying \`$tag\` to $environment on $project.
SLACK_MESSAGE=":loading: Deploying $tag_link to $environment on $project.
$url
SHA: \`$commit_sha\`"
SHA: $commit_link"
;;
success)
SLACK_MESSAGE=":white_check_mark: Deployed \`$tag\` to $environment on $project.
SLACK_MESSAGE=":white_check_mark: Deployed $tag_link to $environment on $project.
$url
SHA: \`$commit_sha\`"
SHA: $commit_link"
;;
failure)
SLACK_MESSAGE=":x: Failed to deploy \`$tag\` to $environment on $project.
SLACK_MESSAGE=":x: Failed to deploy $tag_link to $environment on $project.
$url
SHA: \`$commit_sha\`
SHA: $commit_link"
Please retry. If the issue persists, share this message in the #team-eng-bre channel for support."
;;
cancelled)
SLACK_MESSAGE=":hand: Cancelled deploy of \`$tag\` to $environment on $project.
SLACK_MESSAGE=":hand: Cancelled deploy of $tag_link to $environment on $project.
$url
SHA: \`$commit_sha\`"
SHA: $commit_link"
;;
no-changes)
SLACK_MESSAGE=":heavy_minus_sign: No changes were made for \`$tag\` deployment to $environment on $project.
SLACK_MESSAGE=":heavy_minus_sign: No changes were made for $tag_link deployment to $environment on $project.
$url
SHA: \`$commit_sha\`"
SHA: $commit_link"
;;
esac
}
Expand Down

0 comments on commit 4dbc62d

Please sign in to comment.