From e6cb44e3167d67b2fa7c9fc977aeeff7198376a8 Mon Sep 17 00:00:00 2001 From: adegomme <13270544+adegomme@users.noreply.github.com> Date: Thu, 15 Jul 2021 19:51:55 +0200 Subject: [PATCH] Github Action : add mattermost notification (#377) * try to notify mattermost on jarfile creation * test2 * test3 * more error messages * actually send the message on build failure --- .github/workflows/jarfile.yml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/.github/workflows/jarfile.yml b/.github/workflows/jarfile.yml index da242638c3..302aa802de 100644 --- a/.github/workflows/jarfile.yml +++ b/.github/workflows/jarfile.yml @@ -56,7 +56,15 @@ jobs: with: name: jar-${{ matrix.config.os }} path: build/simgrid.jar - + - name: Create the failure Message + if: ${{ failure() }} + run: | + echo "{\"text\":\"Failure when building JAR file on ${{ matrix.config.name }}! See ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} \"}" > mattermost.json + - uses: mattermost/action-mattermost-notify@master + if: ${{ failure() }} + env: + MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }} + MATTERMOST_CHANNEL: ${{ secrets.MATTERMOST_CHANNEL}} create_jar: needs: build runs-on: ubuntu-latest @@ -92,3 +100,16 @@ jobs: jar-ubuntu jar-windows jar-macos + - name: Create the failure Message + if: ${{ failure() }} + run: | + echo "{\"text\":\"Failure when assembling JAR file ! See ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} \"}" > mattermost.json + - name: Create the success Message + if: ${{ success() }} + run: | + echo "{\"text\":\"JAR file built successfully ! You can get it on: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} \"}" > mattermost.json + - uses: mattermost/action-mattermost-notify@master + env: + MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }} + MATTERMOST_CHANNEL: ${{ secrets.MATTERMOST_CHANNEL}} + -- 2.20.1