From 8356a4891271eaa35a1e478d29adc1ec9044b9c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Kukli=C5=84ski?= Date: Thu, 13 Jul 2023 21:31:26 +0200 Subject: [PATCH] Add slack notifications on failed builds --- .github/workflows/build.yml | 13 +++++++++++++ .github/workflows/coding_standard.yml | 12 ++++++++++++ 2 files changed, 25 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 02f8c524b..488d6453d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -180,3 +180,16 @@ jobs: name: Behat logs path: etc/build/ if-no-files-found: ignore + + - + name: Failed build Slack notification + uses: rtCamp/action-slack-notify@v2 + if: ${{ failure() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') }} + env: + SLACK_CHANNEL: ${{ secrets.FAILED_BUILD_SLACK_CHANNEL }} + SLACK_COLOR: ${{ job.status }} + SLACK_ICON: https://github.com/rtCamp.png?size=48 + SLACK_MESSAGE: ':x:' + SLACK_TITLE: Failed build on ${{ github.event.repository.name }} repository + SLACK_USERNAME: ${{ secrets.FAILED_BUILD_SLACK_USERNAME }} + SLACK_WEBHOOK: ${{ secrets.FAILED_BUILD_SLACK_WEBHOOK }} \ No newline at end of file diff --git a/.github/workflows/coding_standard.yml b/.github/workflows/coding_standard.yml index bd0653b02..7cc89e505 100644 --- a/.github/workflows/coding_standard.yml +++ b/.github/workflows/coding_standard.yml @@ -81,3 +81,15 @@ jobs: - name: Run ECS run: vendor/bin/ecs + + - name: Failed build Slack notification + uses: rtCamp/action-slack-notify@v2 + if: ${{ failure() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') }} + env: + SLACK_CHANNEL: ${{ secrets.FAILED_BUILD_SLACK_CHANNEL }} + SLACK_COLOR: ${{ job.status }} + SLACK_ICON: https://github.com/rtCamp.png?size=48 + SLACK_MESSAGE: ':x:' + SLACK_TITLE: Failed build on ${{ github.event.repository.name }} repository + SLACK_USERNAME: ${{ secrets.FAILED_BUILD_SLACK_USERNAME }} + SLACK_WEBHOOK: ${{ secrets.FAILED_BUILD_SLACK_WEBHOOK }} \ No newline at end of file