Skip to content

Commit

Permalink
Made use of reusable slack notification action
Browse files Browse the repository at this point in the history
  • Loading branch information
252afh committed Jul 9, 2024
1 parent af4a47a commit 90513ce
Showing 1 changed file with 62 additions and 25 deletions.
87 changes: 62 additions & 25 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,56 +86,93 @@ jobs:
cd _site
aws s3 cp . ${{ secrets.S3_BUCKET_LOCATION }} --recursive
# notify-slack:
# needs:
# - set-vars
# - start-runner
# - publish-website
# runs-on: ${{ needs.start-runner.outputs.label }}
# steps:
# - name: notify slack failure
# id: slack-failure
# uses: slackapi/[email protected]
# if: ${{ failure() }}
# with:
# payload: |
# {
# "text": "Failed to deploy",
# "blocks": [
# {
# "type": "header",
# "text": {
# "type": "plain_text",
# "text": "Failed to deploy main to the ai gov uk website :aaaaaaaaaa:"
# }
# }
# ]
# }
# env:
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
# SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK

# - name: notify slack pass
# id: slack-pass
# uses: slackapi/[email protected]
# if: ${{ success() }}
# with:
# payload: |
# {
# "text": "Deployment succeeded :airplane:",
# "blocks": [
# {
# "type": "header",
# "text": {
# "type": "plain_text",
# "text": "Deployed main to ai gov uk website :hype-elmo:"
# }
# }
# ]
# }
# env:
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
# SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK

notify-slack:
uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/notify-slack.yml@3bd8b19970db8d6c6c919831aaa9fa74033fb8a7
needs:
- set-vars
- start-runner
- publish-website
runs-on: ${{ needs.start-runner.outputs.label }}
steps:
- name: notify slack failure
id: slack-failure
uses: slackapi/[email protected]
if: ${{ failure() }}
with:
payload: |
with:
RUNNER_LABEL: ${{ needs.start-runner.outputs.label }}
SUCCESS_PAYLOAD: |
{
"text": "Failed to deploy",
"text": "Deployment succeeded :airplane:",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "Failed to deploy main to the ai gov uk website :aaaaaaaaaa:"
"text": "Deployed main to ai gov uk website :hype-elmo:"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK

- name: notify slack pass
id: slack-pass
uses: slackapi/[email protected]
if: ${{ success() }}
with:
payload: |
FAILURE_PAYLOAD: |
{
"text": "Deployment succeeded :airplane:",
"text": "Failed to deploy",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "Deployed main to ai gov uk website :hype-elmo:"
"text": "Failed to deploy main to the ai gov uk website :aaaaaaaaaa:"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
secrets:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

stop-runner:
uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/stop-runner.yml@main
Expand Down

0 comments on commit 90513ce

Please sign in to comment.