From 54e2c9f0b68a063a78b036494d90cc42c47b1eaa Mon Sep 17 00:00:00 2001 From: Evgeniy Frolov Date: Tue, 17 Dec 2024 13:42:30 +0300 Subject: [PATCH] chore(ci): update notifications Signed-off-by: Evgeniy Frolov --- .github/workflows/_notification.yml | 73 -------------------------- .github/workflows/tests.yml | 2 +- .github/workflows/trdl_publisher.yml | 2 +- .github/workflows/trdl_releaser.yml | 2 +- .github/workflows/website_converge.yml | 2 +- 5 files changed, 4 insertions(+), 77 deletions(-) delete mode 100644 .github/workflows/_notification.yml diff --git a/.github/workflows/_notification.yml b/.github/workflows/_notification.yml deleted file mode 100644 index d4da2bfb..00000000 --- a/.github/workflows/_notification.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: xxxxx(internal) - -on: - workflow_call: - secrets: - webhook: - description: "Loop webhook URL" - required: true - notificationChannel: - description: "Loop notification channel" - required: true - loopNotificationGroup: - description: "Loop notification group" - required: false - -defaults: - run: - shell: bash - -jobs: - _: - runs-on: ubuntu-22.04 - timeout-minutes: 10 - steps: - - name: Run workflow status conclusion manager - 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' && (startsWith(github.ref, 'refs/pull/') || github.event_name == 'workflow_dispatch') - 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' && ! startsWith(github.ref, 'refs/pull/') && github.event_name != 'workflow_dispatch' )" - name: Failure notify - uses: mattermost/action-mattermost-notify@master - with: - MATTERMOST_WEBHOOK_URL: ${{ secrets.webhook }} - MATTERMOST_CHANNEL: ${{ secrets.notificationChannel }} - TEXT: | - ${{ secrets.loopNotificationGroup }} Прод упал в ${{ github.repository }} :pepe_monkaw: - [${{ github.workflow }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) ${{ github.ref_name }} :pepe_deadge: - Упавшие джобы: - ${{ steps.failed_jobs.outputs.failed }} - - - if: env.WORKFLOW_CONCLUSION == 'success' - name: Success notify - uses: mattermost/action-mattermost-notify@master - with: - MATTERMOST_WEBHOOK_URL: ${{ secrets.webhook }} - MATTERMOST_CHANNEL: ${{ secrets.notificationChannel }} - TEXT: | - Workflow успешно завершился в ${{ github.repository }} :bender: - [${{ github.workflow }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) ${{ github.ref_name }} :success: - - - if: env.WORKFLOW_CONCLUSION == 'failure' && (startsWith(github.ref, 'refs/pull/') || github.event_name == 'workflow_dispatch') - name: Failure notify for PRs - uses: mattermost/action-mattermost-notify@master - with: - MATTERMOST_WEBHOOK_URL: ${{ secrets.webhook }} - MATTERMOST_CHANNEL: ${{ secrets.notificationChannel }} - TEXT: | - @${{ steps.get_user.outputs.username }} Проблема в ветке в ${{ github.repository }} :press_f: - [${{ github.workflow }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) ${{ github.ref_name }} :pepe_deadge: - Упавшие джобы: - ${{ steps.failed_jobs.outputs.failed }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1b742576..74063935 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -177,7 +177,7 @@ jobs: name: Notification if: always() needs: upload_coverage - uses: ./.github/workflows/_notification.yml + uses: werf/ci-reusable-workflows/.github/workflows/notification.yml@main secrets: loopNotificationGroup: ${{ secrets.LOOP_NOTIFICATION_GROUP }} webhook: ${{ secrets.LOOP_NOTIFICATION_WEBHOOK }} diff --git a/.github/workflows/trdl_publisher.yml b/.github/workflows/trdl_publisher.yml index ea013117..41912fda 100644 --- a/.github/workflows/trdl_publisher.yml +++ b/.github/workflows/trdl_publisher.yml @@ -34,7 +34,7 @@ jobs: name: Notification if: always() needs: publish - uses: ./.github/workflows/_notification.yml + uses: werf/ci-reusable-workflows/.github/workflows/notification.yml@main secrets: loopNotificationGroup: ${{ secrets.LOOP_NOTIFICATION_GROUP }} webhook: ${{ secrets.LOOP_NOTIFICATION_WEBHOOK }} diff --git a/.github/workflows/trdl_releaser.yml b/.github/workflows/trdl_releaser.yml index 2b758959..10e7b28b 100644 --- a/.github/workflows/trdl_releaser.yml +++ b/.github/workflows/trdl_releaser.yml @@ -33,7 +33,7 @@ jobs: name: Notification if: always() && startsWith(github.ref, 'refs/tags/v') needs: release - uses: ./.github/workflows/_notification.yml + uses: werf/ci-reusable-workflows/.github/workflows/notification.yml@main secrets: loopNotificationGroup: ${{ secrets.LOOP_NOTIFICATION_GROUP }} webhook: ${{ secrets.LOOP_NOTIFICATION_WEBHOOK }} diff --git a/.github/workflows/website_converge.yml b/.github/workflows/website_converge.yml index 81c26507..2667e7eb 100644 --- a/.github/workflows/website_converge.yml +++ b/.github/workflows/website_converge.yml @@ -37,7 +37,7 @@ jobs: name: Notification if: always() needs: converge - uses: ./.github/workflows/_notification.yml + uses: werf/ci-reusable-workflows/.github/workflows/notification.yml@main secrets: loopNotificationGroup: ${{ secrets.LOOP_NOTIFICATION_GROUP }} webhook: ${{ secrets.LOOP_NOTIFICATION_WEBHOOK }}