Skip to content

Commit

Permalink
chore(ci): update notifications (#765)
Browse files Browse the repository at this point in the history
* chore(ci): update notifications

Signed-off-by: Evgeniy Frolov <[email protected]>

* chore(ci): update project name

Signed-off-by: Evgeniy Frolov <[email protected]>

---------

Signed-off-by: Evgeniy Frolov <[email protected]>
  • Loading branch information
Fral738 authored Dec 18, 2024
1 parent 0290419 commit 52c37d6
Showing 1 changed file with 5 additions and 63 deletions.
68 changes: 5 additions & 63 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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<<EOF' >> $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 }}

0 comments on commit 52c37d6

Please sign in to comment.