From e22fb7d9231ee75f5ce97d12140cad537d8daf74 Mon Sep 17 00:00:00 2001 From: Opeyemi Date: Tue, 16 Jan 2024 16:28:45 +0000 Subject: [PATCH] Add the Commit sha of the branch or tag deployed (#235) --- .../test-report-deployment-status-to-slack.yml | 5 ++++- report-deployment-status-to-slack/action.yml | 13 ++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-report-deployment-status-to-slack.yml b/.github/workflows/test-report-deployment-status-to-slack.yml index e152ffdc..dca909ab 100644 --- a/.github/workflows/test-report-deployment-status-to-slack.yml +++ b/.github/workflows/test-report-deployment-status-to-slack.yml @@ -3,7 +3,7 @@ name: Test report-deployment-status-to-slack on: pull_request: paths: - - "./report-deployment-status-to-slack" + - "./report-deployment-status-to-slack/**" - ".github/workflows/test-report-deployment-status-to-slack.yml" jobs: @@ -20,6 +20,7 @@ jobs: tag: test-workflow-start slack-channel: devops-alerts-test event: 'start' + commit-sha: ${{ github.sha }} url: https://github.com/bitwarden/gh-actions/actions/runs/${{ github.run_id }} AZURE_KV_CI_SERVICE_PRINCIPAL: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} @@ -36,6 +37,7 @@ jobs: tag: test-workflow-success slack-channel: devops-alerts-test event: 'success' + commit-sha: ${{ github.sha }} url: https://github.com/bitwarden/gh-actions/actions/runs/${{ github.run_id }} AZURE_KV_CI_SERVICE_PRINCIPAL: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} @@ -52,6 +54,7 @@ jobs: tag: test-workflow-failure slack-channel: devops-alerts-test event: 'failure' + commit-sha: ${{ github.sha }} url: https://github.com/bitwarden/gh-actions/actions/runs/${{ github.run_id }} AZURE_KV_CI_SERVICE_PRINCIPAL: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} diff --git a/report-deployment-status-to-slack/action.yml b/report-deployment-status-to-slack/action.yml index 66d41a7e..330c586a 100644 --- a/report-deployment-status-to-slack/action.yml +++ b/report-deployment-status-to-slack/action.yml @@ -7,6 +7,9 @@ inputs: tag: description: "The name of the branch or tag." required: true + commit-sha: + description: "The SHA of the branch or tag." + required: true environment: description: "The name of the environment." required: true @@ -56,23 +59,27 @@ runs: case "${{ inputs.event }}" in start) SLACK_MESSAGE=":loading: Updating ${{ inputs.environment }} to \`${{ inputs.tag }}\` on ${{ inputs.project }}. - ${{ inputs.url }}" + ${{ inputs.url }} + SHA: \`${{ inputs.commit-sha }}\`" ;; success) SLACK_MESSAGE=":white_check_mark: Updated ${{ inputs.environment }} to \`${{ inputs.tag }}\` on ${{ inputs.project }}. - ${{ inputs.url }}" + ${{ inputs.url }} + SHA: \`${{ inputs.commit-sha }}\`" ;; failure) SLACK_MESSAGE=":x: Failed to update ${{ inputs.environment }} to \`${{ inputs.tag }}\` on ${{ inputs.project }}. ${{ inputs.url }} + SHA: \`${{ inputs.commit-sha }}\` Please retry or contact @devops team." ;; cancelled) SLACK_MESSAGE=":hand: Cancelled update of ${{ inputs.environment }} to \`${{ inputs.tag }}\` on ${{ inputs.project }}. - ${{ inputs.url }}" + ${{ inputs.url }} + SHA: \`${{ inputs.commit-sha }}\`" ;; esac