-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): update notifications (#279)
Signed-off-by: Evgeniy Frolov <[email protected]>
- Loading branch information
Showing
12 changed files
with
232 additions
and
194 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
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<<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' && startsWith(github.ref, 'refs/pull/')) | ||
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/'))" | ||
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/')) | ||
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.