From 8610a521326db1a87084792466ba68a74776c357 Mon Sep 17 00:00:00 2001 From: Simon Templer Date: Fri, 6 Oct 2023 17:38:00 +0200 Subject: [PATCH] refactor: notify failure for Gradle library publishing --- .github/workflows/gradle-library-check.yml | 1 + .github/workflows/gradle-library.yml | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/.github/workflows/gradle-library-check.yml b/.github/workflows/gradle-library-check.yml index b55ea4c..f2080b8 100644 --- a/.github/workflows/gradle-library-check.yml +++ b/.github/workflows/gradle-library-check.yml @@ -17,4 +17,5 @@ jobs: with: gradle-tasks: 'clean check' java-version: ${{ inputs.java-version }} + notify-failure: false secrets: inherit diff --git a/.github/workflows/gradle-library.yml b/.github/workflows/gradle-library.yml index 3c75e5b..1508bcc 100644 --- a/.github/workflows/gradle-library.yml +++ b/.github/workflows/gradle-library.yml @@ -9,6 +9,9 @@ on: description: Java version to use for build required: true type: string + notify-failure: + default: true + type: boolean secrets: GH_PAT: required: true @@ -115,3 +118,18 @@ jobs: annotate_only: true detailed_summary: true fail_on_failure: true # in case of critical security vulnerabilities + + # + # Report build failure to Slack + # + + # https://github.com/marketplace/actions/slack-notify-build + - name: Notify slack fail + if: ${{ inputs.notify-failure && failure() }} + env: + SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }} + uses: voxmedia/github-action-slack-notify-build@v1 + with: + channel: build-failures + status: FAILED + color: danger