Skip to content

Commit

Permalink
chore: loosen up and refine slack notifications (#146)
Browse files Browse the repository at this point in the history
Signed-off-by: Niccolò Fei <[email protected]>
  • Loading branch information
NiccoloFei authored Jun 22, 2023
1 parent df4ce1c commit 235258f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 17 deletions.
20 changes: 3 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,27 +116,13 @@ jobs:
build-args: |
SUBSCRIPTION_NAME=docker-postgresql-cicd-${{ github.run_number }}
# Send a notification on release failure
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
if: ${{ failure() }}
if: ${{ failure() && github.ref == 'refs/heads/main' }}
env:
SLACK_COLOR: ${{ job.status }}
SLACK_ICON: https://avatars.githubusercontent.com/u/44036562?size=48
SLACK_USERNAME: ghBot
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
# Send a notification if new public images are released
notify:
needs: build
name: Notify update on Slack
runs-on: ubuntu-20.04
steps:
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
# Only images built from the main branch go public, and we limit the
# amount of notifications to those.
if: ${{ github.ref == 'refs/heads/main' }}
env:
SLACK_ICON: https://avatars.githubusercontent.com/u/44036562?size=48
SLACK_USERNAME: ghBot
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_MESSAGE: New PostgreSQL images pushed on Quay.io
SLACK_MESSAGE: "Failure releasing PostgreSQL ${{ matrix.name }} image"
9 changes: 9 additions & 0 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,12 @@ jobs:
access_token: ${{ secrets.REPO_GHA_PAT }}
branch: main
enforce_admins: ${{ steps.disable_include_admins.outputs.initial_status }}
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
if: ${{ failure() && github.ref == 'refs/heads/main' }}
env:
SLACK_COLOR: ${{ job.status }}
SLACK_ICON: https://avatars.githubusercontent.com/u/44036562?size=48
SLACK_USERNAME: ghBot
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_MESSAGE: Failure updating PostgreSQL images

0 comments on commit 235258f

Please sign in to comment.