From 235258fbc80378eb63f60bc11217d85e4dda3177 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Fei?= Date: Thu, 22 Jun 2023 11:24:22 +0200 Subject: [PATCH] chore: loosen up and refine slack notifications (#146) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Niccolò Fei --- .github/workflows/build.yml | 20 +++----------------- .github/workflows/update.yml | 9 +++++++++ 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3212c7908..f158d51c4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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" diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml index f0203b8b3..7a4f08c93 100644 --- a/.github/workflows/update.yml +++ b/.github/workflows/update.yml @@ -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