From cd38b93276e9dfc779e6c97aacfbebfbd78f9476 Mon Sep 17 00:00:00 2001 From: Tony Hsu Date: Fri, 24 May 2024 00:45:23 +0200 Subject: [PATCH] Notify once --- .github/actions/slack/action.yml | 3 +++ .github/workflows/test.yml | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/actions/slack/action.yml b/.github/actions/slack/action.yml index 81ffd2f..00fbd66 100644 --- a/.github/actions/slack/action.yml +++ b/.github/actions/slack/action.yml @@ -1,5 +1,7 @@ name: Slack Notification + description: 'Send slack notification' + inputs: message: description: 'Message to send' @@ -10,6 +12,7 @@ inputs: token: description: 'Slack bot token' required: true + runs: using: "composite" steps: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d496998..ef4ef9d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -43,14 +43,18 @@ jobs: DD_ENV: ci run: bundle exec rake spec - - if: ${{ success() }} + notify: + needs: test + runs-on: ubuntu-latest + steps: + - if: ${{ needs.test.result == 'success' }} uses: ./.github/actions/slack with: message: ":tada: Tests passed!" channel: ${{ vars.SLACK_CHANNEL_ID }} token: ${{ secrets.SLACK_BOT_TOKEN }} - - if: ${{ failure() }} + - if: ${{ needs.test.result == 'failure' }} uses: ./.github/actions/slack with: message: ":red-light: Tests failed!"