From a2ca360e9ebef9b0e912a3a21fd112b2f6adf247 Mon Sep 17 00:00:00 2001 From: Mitchell Suzuki Date: Thu, 20 Feb 2025 11:54:02 -0700 Subject: [PATCH] 514P-270: Notify slack on failed workflows (#2050) --- .github/workflows/deploy-internal-app.yaml | 11 +++++++++++ .github/workflows/format.yaml | 11 +++++++++++ .github/workflows/release-cli.yaml | 19 +++++++++++++++++++ .github/workflows/rfd-bot.yaml | 11 +++++++++++ .github/workflows/test-framework-cli.yaml | 11 +++++++++++ 5 files changed, 63 insertions(+) diff --git a/.github/workflows/deploy-internal-app.yaml b/.github/workflows/deploy-internal-app.yaml index ba1b13e21..7a163dc86 100644 --- a/.github/workflows/deploy-internal-app.yaml +++ b/.github/workflows/deploy-internal-app.yaml @@ -91,3 +91,14 @@ jobs: if: ${{ !inputs.dry-run }} run: | kubectl rollout status deployment/moosedeployment + + notify-slack-on-failure: + needs: [deploy-internal] + runs-on: ubuntu-latest + if: failure() && github.ref == 'refs/heads/main' + steps: + - name: Notify Slack on failure + uses: 514-labs/slack-notification-action@1.0.0 + with: + slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }} + slack-webhook-url: ${{ secrets.SLACK_GITHUB_ACTIONS_WEBHOOK_URL }} diff --git a/.github/workflows/format.yaml b/.github/workflows/format.yaml index 5a128109d..a207a5088 100644 --- a/.github/workflows/format.yaml +++ b/.github/workflows/format.yaml @@ -18,3 +18,14 @@ jobs: run: pnpm install --frozen-lockfile - name: Check prettier compliance run: pnpm exec prettier --check './apps/**/*.{ts,tsx}' + + notify-slack-on-failure: + needs: [format] + runs-on: ubuntu-latest + if: failure() && github.ref == 'refs/heads/main' + steps: + - name: Notify Slack on failure + uses: 514-labs/slack-notification-action@1.0.0 + with: + slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }} + slack-webhook-url: ${{ secrets.SLACK_GITHUB_ACTIONS_WEBHOOK_URL }} \ No newline at end of file diff --git a/.github/workflows/release-cli.yaml b/.github/workflows/release-cli.yaml index 9dcf7ab37..1a5b374a3 100644 --- a/.github/workflows/release-cli.yaml +++ b/.github/workflows/release-cli.yaml @@ -481,3 +481,22 @@ jobs: cache-to: type=gha,mode=max build-args: | FRAMEWORK_VERSION=${{ needs.version.outputs.version }} + + notify-slack-on-failure: + needs: [ + build-and-publish-py-moose-lib, + package-and-publish-independant-ts-package, + package-and-publish-templates, + build-and-publish-binaries, + release-python, + publish-npm-base, + build-and-publish-fullstack-image + ] + runs-on: ubuntu-latest + if: failure() && github.ref == 'refs/heads/main' + steps: + - name: Notify Slack on failure + uses: 514-labs/slack-notification-action@1.0.0 + with: + slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }} + slack-webhook-url: ${{ secrets.SLACK_GITHUB_ACTIONS_WEBHOOK_URL }} \ No newline at end of file diff --git a/.github/workflows/rfd-bot.yaml b/.github/workflows/rfd-bot.yaml index 62aa657ef..c886e1984 100644 --- a/.github/workflows/rfd-bot.yaml +++ b/.github/workflows/rfd-bot.yaml @@ -43,3 +43,14 @@ jobs: add: "rfd" author_name: "🤖 RFD Bot" message: "chore(rfd): 🤖 claim RFD ${{ env.RFD_NUMBER }}" + + notify-slack-on-failure: + needs: [claim-rfd-number] + runs-on: ubuntu-latest + if: failure() && github.ref == 'refs/heads/main' + steps: + - name: Notify Slack on failure + uses: 514-labs/slack-notification-action@1.0.0 + with: + slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }} + slack-webhook-url: ${{ secrets.SLACK_GITHUB_ACTIONS_WEBHOOK_URL }} \ No newline at end of file diff --git a/.github/workflows/test-framework-cli.yaml b/.github/workflows/test-framework-cli.yaml index 097b47245..2c0592ffc 100644 --- a/.github/workflows/test-framework-cli.yaml +++ b/.github/workflows/test-framework-cli.yaml @@ -179,3 +179,14 @@ jobs: with: command: clippy args: --manifest-path ./apps/framework-cli/Cargo.toml -- -D warnings + + notify-slack-on-failure: + needs: [check, test-macos, test-ubuntu, lints] + runs-on: ubuntu-latest + if: failure() && github.ref == 'refs/heads/main' + steps: + - name: Notify Slack on failure + uses: 514-labs/slack-notification-action@1.0.0 + with: + slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }} + slack-webhook-url: ${{ secrets.SLACK_GITHUB_ACTIONS_WEBHOOK_URL }} \ No newline at end of file