Skip to content

Commit

Permalink
Pass inputs in the function
Browse files Browse the repository at this point in the history
  • Loading branch information
Eeebru committed Feb 16, 2024
1 parent 1592595 commit 9324024
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions report-deployment-status-to-slack/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ runs:
shell: bash
run: |
function slack_message_fn () {
local event=$1
local environment=$2
local tag=$3
local project=$4
local url=$5
local commit_sha=$6
local event="${{ inputs.event }}"
local environment="${{ inputs.environment }}"
local tag="${{ inputs.tag }}"
local project="${{ inputs.project }}"
local url="${{ inputs.url }}"
local commit_sha="${{ inputs.commit-sha }}"
case $event in
start)
Expand All @@ -76,32 +76,32 @@ runs:
;;
success)
SLACK_MESSAGE=":white_check_mark: Updated $environment to \`$3\` on $project.
SLACK_MESSAGE=":white_check_mark: Updated $environment to \`$tag\` on $project.
$url
SHA: \`$commit_sha\`"
;;
failure)
SLACK_MESSAGE=":x: Failed to update $environment to \`$3\` on $project.
SLACK_MESSAGE=":x: Failed to update $environment to \`$tag\` on $project.
$url
SHA: \`$commit_sha\`
Please retry or contact @devops team."
;;
cancelled)
SLACK_MESSAGE=":hand: Cancelled update of $environment to \`$3\` on $project.
SLACK_MESSAGE=":hand: Cancelled update of $environment to \`$tag\` on $project.
$url
SHA: \`$commit_sha\`"
;;
esac
}
if [[ ${{ inputs.db_migration_detected }} == true && ${{ inputs.tag }} != main && ${{ inputs.tag }} != rc && ${{ inputs.tag }} != hotfix-rc ]]; then
slack_message_fn "${{ inputs.event }}" "${{ inputs.environment }}" "${{ inputs.tag }}" "${{ inputs.project }}" "${{ inputs.url }}" "${{ inputs.commit-sha }}"
slack_message_fn
SLACK_MESSAGE="$SLACK_MESSAGE
:red_siren: This branch has new database migration changes."
else
slack_message_fn "${{ inputs.event }}" "${{ inputs.environment }}" "${{ inputs.tag }}" "${{ inputs.project }}" "${{ inputs.url }}" "${{ inputs.commit-sha }}"
slack_message_fn
fi
echo 'slack_message<<EOF' >> $GITHUB_OUTPUT
Expand Down

0 comments on commit 9324024

Please sign in to comment.