-
Notifications
You must be signed in to change notification settings - Fork 393
114 lines (109 loc) · 3.59 KB
/
slackNotification.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: Send Slack Notification
on:
workflow_call:
inputs:
result:
description: Result of the previous workflow
type: string
title:
description: Title for the slack message
type: string
failedEvent:
description: Name of the failed event
type: string
successfulEvent:
description: URL for the successful event
type: string
notification:
description: The message to be displayed for a notification.
type: string
type:
description: Action type
type: string
workflow:
description: Caller workflow
type: string
summary:
description: Summary of e2e results
type: string
testsBranch:
description: Branch from the E2E Automation Tests repo
type: string
vscodeVersion:
description: VSCode version that the tests were run on
type: string
secrets:
IDEE_RELEASE_SLACK_WEBHOOK:
required: true
IDEE_MAIN_SLACK_WEBHOOK:
required: true
IDEE_E2E_SLACK_WEBHOOK:
required: true
jobs:
notification_on_success:
runs-on: ubuntu-latest
if: inputs.result == 'success'
steps:
- name: Announce success
uses: slackapi/slack-github-action@v1.22.0
with:
payload: |
{
"text": "${{ inputs.title }} successfully ${{ inputs.type }}",
"event": "${{ inputs.successfulEvent }}",
"repo": "${{ github.event.repository.name }}",
"result": "Success"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.IDEE_RELEASE_SLACK_WEBHOOK }}
notification_on_failure:
runs-on: ubuntu-latest
if: inputs.result == 'failure'
steps:
- name: Announce failure
uses: slackapi/slack-github-action@v1.22.0
with:
payload: |
{
"text": "${{ inputs.title }} unsuccessfully ${{ inputs.type }}",
"event": "${{ inputs.failedEvent }}, run: ${{ github.event.repository.html_url }}/actions/workflows/${{ inputs.workflow }}",
"repo": "${{ github.event.repository.name }}",
"result": "Failure"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.IDEE_MAIN_SLACK_WEBHOOK }}
general_notification:
runs-on: ubuntu-latest
if: inputs.type == 'notification'
steps:
- name: General Notification
uses: slackapi/slack-github-action@v1.22.0
with:
payload: |
{
"text": "${{ inputs.title }}",
"event": "${{ inputs.notification }}, run: ${{ github.event.repository.html_url }}/actions/workflows/${{ inputs.workflow }}",
"repo": "${{ github.event.repository.name }}",
"result": "Notification"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.IDEE_MAIN_SLACK_WEBHOOK }}
e2e_notification:
runs-on: ubuntu-latest
if: inputs.type == 'e2e'
steps:
- name: E2E Tests slack notification
uses: slackapi/slack-github-action@v1.22.0
with:
payload: |
{
"category": "${{ inputs.title }}",
"vscodeVersion": "${{ inputs.vscodeVersion }}",
"branch": "${{ github.ref_name }}",
"testsBranch": "${{ inputs.testsBranch }}",
"summary": "${{ inputs.summary }}",
"event": "${{ github.event.repository.html_url }}/${{ inputs.workflow }}",
"result": "${{ inputs.result }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.IDEE_E2E_SLACK_WEBHOOK }}