1
0
mirror of https://github.com/Infisical/infisical.git synced 2025-03-17 00:01:55 +00:00

Compare commits

...

1 Commits

Author SHA1 Message Date
e624eebd9f add slack notification message on success 2024-12-20 17:33:36 -08:00
2 changed files with 60 additions and 0 deletions
.github
actions/notify-slack
workflows

@ -0,0 +1,42 @@
name: notify-slack
description: notify slack
inputs:
channel:
description: channel to send message
required: true
token:
description: token with chat:write and chat:write.public permissions
required: true
message:
description: message formatted in Markdown
required: true
runs:
using: composite
steps:
# see https://api.slack.com/tutorials/tracks/posting-messages-with-curl#let-us-hello-then__making-your-messages-more-fantastic
- name: notify-slack
shell: bash
run: |
curl https://slack.com/api/chat.postMessage \
-X POST --fail --silent --show-error \
-H "Authorization: Bearer ${SLACK_TOKEN}" \
-H "Content-type: application/json; charset=utf-8" \
--data @<(yq -pjson -ojson '.channel = env(SLACK_CHANNEL) | .blocks[0].text.text = env(MESSAGE)' <<'EOF'
{
"channel": "<replace me>",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "<replace me>"
}
}
]
}
EOF
) >/dev/null
env:
SLACK_CHANNEL: ${{ inputs.channel }}
SLACK_TOKEN: ${{ inputs.token }}
MESSAGE: ${{ inputs.message }}

@ -103,6 +103,12 @@ jobs:
service: infisical-core-gamma-stage
cluster: infisical-gamma-stage
wait-for-service-stability: true
# only notify of success because continue-on-error is so tricky, see https://www.kenmuse.com/blog/how-to-handle-step-and-job-errors-in-github-actions/
- uses: ./.github/actions/notify-slack
with:
token: ${{ secrets.SLACK_TOKEN }}
channel: ${{ secrets.SLACK_CHANNEL }}
message: deployed infisical/staging_infisical:${{ steps.commit.outputs.short }} to ${{ vars.ENVIRONMENT }}
production-us:
name: US production deploy
@ -159,6 +165,12 @@ jobs:
service: infisical-core-platform
cluster: infisical-core-platform
wait-for-service-stability: true
# only notify of success because continue-on-error is so tricky, see https://www.kenmuse.com/blog/how-to-handle-step-and-job-errors-in-github-actions/
- uses: ./.github/actions/notify-slack
with:
token: ${{ secrets.SLACK_TOKEN }}
channel: ${{ secrets.SLACK_CHANNEL }}
message: deployed infisical/staging_infisical:${{ steps.commit.outputs.short }} to ${{ vars.ENVIRONMENT }}
production-eu:
name: EU production deploy
@ -210,3 +222,9 @@ jobs:
service: infisical-core-platform
cluster: infisical-core-platform
wait-for-service-stability: true
# only notify of success because continue-on-error is so tricky, see https://www.kenmuse.com/blog/how-to-handle-step-and-job-errors-in-github-actions/
- uses: ./.github/actions/notify-slack
with:
token: ${{ secrets.SLACK_TOKEN }}
channel: ${{ secrets.SLACK_CHANNEL }}
message: deployed infisical/staging_infisical:${{ steps.commit.outputs.short }} to ${{ vars.ENVIRONMENT }}