Skip to content

Commit

Permalink
Merge pull request #44 from i-dot-ai/bugfix/fix-slack-notification
Browse files Browse the repository at this point in the history
Fixed slack notification step
  • Loading branch information
252afh authored Aug 1, 2024
2 parents 17fecd6 + 7e03b83 commit c8463ad
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,36 @@ jobs:
cd _site
aws s3 cp . s3://${{ secrets[inputs.destination_bucket] }}/ --recursive
determine-success:
needs:
- set-vars
- start-runner
- publish-website
runs-on: ${{ needs.start-runner.outputs.label }}
if: always()
outputs:
success: ${{ steps.success.outputs.success }}
steps:
- id: success
run: |
if [[ "${{ needs.publish-website.result }}" == "success" ]]; then
echo "success=true" >> $GITHUB_OUTPUT
else
echo "success=false" >> $GITHUB_OUTPUT
fi
notify-slack:
uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/slack-notify.yml@main
needs:
- set-vars
- start-runner
- publish-website
- determine-success
with:
RUNNER_LABEL: ${{ needs.start-runner.outputs.label }}
SUCCESS_PAYLOAD: "{\"text\": \"Deployment succeeded :airplane:\", \"blocks\": [{\"type\": \"header\",\"text\": {\"type\": \"plain_text\",\"text\": \"Deployed main to ai gov uk website :hype-elmo:\"}}]}"
FAILURE_PAYLOAD: "{\"text\": \"Failed to deploy\",\"blocks\": [{\"type\": \"header\",\"text\": {\"type\": \"plain_text\",\"text\": \"Failed to deploy main to the ai gov uk website :aaaaaaaaaa:\"}}]}"
WORKFLOW_PASSED: ${{ needs.determine-success.outputs.success == 'true' }}
SUCCESS_PAYLOAD: "{\"text\": \"Deployment succeeded to ${{ inputs.environment }} :airplane:\", \"blocks\": [{\"type\": \"header\",\"text\": {\"type\": \"plain_text\",\"text\": \"Deployed main to ai gov uk website :hype-elmo:\"}}]}"
FAILURE_PAYLOAD: "{\"text\": \"Failed to deploy to ${{ inputs.environment }}\",\"blocks\": [{\"type\": \"header\",\"text\": {\"type\": \"plain_text\",\"text\": \"Failed to deploy main to the ai gov uk website :aaaaaaaaaa:\"}}]}"
secrets:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

Expand All @@ -111,6 +131,7 @@ jobs:
- set-vars
- start-runner
- publish-website
- determine-success
- notify-slack
with:
RUNNER_LABEL: ${{ needs.start-runner.outputs.label }}
Expand Down

0 comments on commit c8463ad

Please sign in to comment.