diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f4431fbed7..3551f7443c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,6 +20,7 @@ jobs: - name: Print lines of code run: cloc --include-lang TypeScript,JavaScript,HTML,Sass,CSS --vcs git + build: name: Build jslib runs-on: ${{ matrix.os }} @@ -67,3 +68,45 @@ jobs: with: name: test-coverage path: coverage/ + + + check-failures: + name: Check for failures + if: always() + runs-on: ubuntu-20.04 + needs: + - cloc + - build + steps: + - name: Check if any job failed + env: + CLOC_STATUS: ${{ needs.cloc.result }} + BUILD_STATUS: ${{ needs.build.result }} + run: | + if [ "$CLOC_STATUS" = "failure" ]; then + exit 1 + elif [ "$BUILD_STATUS" = "failure" ]; then + exit 1 + fi + + - name: Login to Azure - Prod Subscription + uses: Azure/login@77f1b2e3fb80c0e8645114159d17008b8a2e475a + if: failure() + with: + creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }} + + - name: Retrieve secrets + id: retrieve-secrets + uses: Azure/get-keyvault-secrets@80ccd3fafe5662407cc2e55f202ee34bfff8c403 + if: failure() + with: + keyvault: "bitwarden-prod-kv" + secrets: "devops-alerts-slack-webhook-url" + + - name: Notify Slack on failure + uses: act10ns/slack@e4e71685b9b239384b0f676a63c32367f59c2522 # v1.2.2 + if: failure() + env: + SLACK_WEBHOOK_URL: ${{ steps.retrieve-secrets.outputs.devops-alerts-slack-webhook-url }} + with: + status: ${{ job.status }}