From 52c37d6406a186cf4c916d4e9a5698723794d292 Mon Sep 17 00:00:00 2001 From: Evgeniy Frolov Date: Wed, 18 Dec 2024 16:45:25 +0300 Subject: [PATCH] chore(ci): update notifications (#765) * chore(ci): update notifications Signed-off-by: Evgeniy Frolov * chore(ci): update project name Signed-off-by: Evgeniy Frolov --------- Signed-off-by: Evgeniy Frolov --- .github/workflows/deploy.yml | 68 +++--------------------------------- 1 file changed, 5 insertions(+), 63 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 2d9a51936..7868697b3 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -78,66 +78,8 @@ jobs: name: Notification if: always() needs: converge - runs-on: ubuntu-latest-4-cores - steps: - - uses: technote-space/workflow-conclusion-action@v3 - - - if: env.WORKFLOW_CONCLUSION == 'failure' - name: get failed jobs - id: failed_jobs - run: | - echo 'failed<> $GITHUB_OUTPUT - echo "$(curl ${{ github.api_url }}/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs | jq -r '.jobs[]| select (.conclusion == "failure") | .html_url')" >> $GITHUB_OUTPUT - echo 'EOF' >> $GITHUB_OUTPUT - - - if: env.WORKFLOW_CONCLUSION == 'failure' && github.ref != 'refs/heads/main' - name: get user - id: get_user - run: | - echo username=$(curl ${{ github.api_url }}/users/${{ github.triggering_actor }} | jq -r '.name' | tr '[:upper:]' '[:lower:]' | tr " " . ) >> $GITHUB_OUTPUT - - - if: env.WORKFLOW_CONCLUSION == 'failure' && github.ref == 'refs/heads/main' - name: Failure notify - uses: mattermost/action-mattermost-notify@master - with: - MATTERMOST_WEBHOOK_URL: ${{ secrets.LOOP_NOTIFICATION_WEBHOOK }} - MATTERMOST_CHANNEL: ${{ secrets.LOOP_NOTIFICATION_CHANNEL }} - TEXT: | - ${{ secrets.LOOP_NOTIFICATION_GROUP }} Публикация документов из ${{ github.repository }} упала :alert: - [${{ github.workflow }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - Упавшие джобы: - ${{ steps.failed_jobs.outputs.failed }} - - - if: env.WORKFLOW_CONCLUSION == 'failure' && github.ref == 'refs/heads/main' - name: Failure notify - uses: mattermost/action-mattermost-notify@master - with: - MATTERMOST_WEBHOOK_URL: ${{ secrets.LOOP_NOTIFICATION_WEBHOOK }} - MATTERMOST_CHANNEL: ${{ secrets.LOOP_NOTIFICATION_CHANNEL }} - TEXT: | - ${{ secrets.LOOP_NOTIFICATION_GROUP }} Публикация документов из ${{ github.repository }} упала :alert: - [${{ github.workflow }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - Упавшие джобы: - ${{ steps.failed_jobs.outputs.failed }} - - - if: env.WORKFLOW_CONCLUSION == 'failure' && github.ref != 'refs/heads/main' - name: Failure notify - uses: mattermost/action-mattermost-notify@master - with: - MATTERMOST_WEBHOOK_URL: ${{ secrets.LOOP_NOTIFICATION_WEBHOOK }} - MATTERMOST_CHANNEL: ${{ secrets.LOOP_NOTIFICATION_CHANNEL }} - TEXT: | - @${{ steps.get_user.outputs.username }} Публикация документов из ${{ github.repository }} упала :alert: - [${{ github.workflow }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - Упавшие джобы: - ${{ steps.failed_jobs.outputs.failed }} - - - if: env.WORKFLOW_CONCLUSION == 'success' && github.ref == 'refs/heads/main' - name: Success notify - uses: mattermost/action-mattermost-notify@master - with: - MATTERMOST_WEBHOOK_URL: ${{ secrets.LOOP_NOTIFICATION_WEBHOOK }} - MATTERMOST_CHANNEL: ${{ secrets.LOOP_NOTIFICATION_CHANNEL }} - TEXT: | - Публикация документов из ${{ github.repository }} завершена :stonks: - [${{ github.workflow }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) + uses: werf/common-ci/.github/workflows/notification.yml@main + secrets: + loopNotificationGroup: ${{ secrets.LOOP_NOTIFICATION_GROUP }} + webhook: ${{ secrets.LOOP_NOTIFICATION_WEBHOOK }} + notificationChannel: ${{ secrets.LOOP_NOTIFICATION_CHANNEL }}