forked from actions/javascript-action
-
Notifications
You must be signed in to change notification settings - Fork 44
152 lines (138 loc) · 4.26 KB
/
test.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
name: Check notification
on:
push: {}
release: {}
jobs:
success:
name: One with everything
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master
- name: MSTeams Notification
uses: ./
if: always()
with:
webhook_url: ${{ secrets.MSTEAMS_WEBHOOK }}
needs: ${{ toJson(needs) }}
job: ${{ toJson(job) }}
steps: ${{ toJson(steps) }}
dry_run: ${{ !github.event.action == 'release' }}
needy_one:
name: One with needs
needs: success
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master
- name: MSTeams Notification
uses: ./
if: always()
with:
webhook_url: ${{ secrets.MSTEAMS_WEBHOOK }}
needs: ${{ toJson(needs) }}
job: ${{ toJson(job) }}
steps: ${{ toJson(steps) }}
dry_run: ${{ !github.event.action == 'release' }}
steps_one:
name: One with steps
needs: success
runs-on: ubuntu-18.04
steps:
- name: Checkout from version control
uses: actions/checkout@master
- name: Do nothing 1
uses: skitionek/star-wars-quote-action@master
- name: Do nothing 2
uses: skitionek/star-wars-quote-action@master
- name: MSTeams Notification
uses: ./
if: always()
with:
webhook_url: ${{ secrets.MSTEAMS_WEBHOOK }}
needs: ${{ toJson(needs) }}
job: ${{ toJson(job) }}
steps: ${{ toJson(steps) }}
dry_run: ${{ !github.event.action == 'release' }}
failure:
name: One failure
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master
- id: Forced_failure
name: Forced failing step
run: |
echo "Output of this action will be localy overwriten to be a failure"
echo "::set-output name=set_status::so_it_is_not_neglected"
- name: Overwrite status
id: overwrites
env:
steps: ${{ toJson(steps) }}
needs: ${{ toJson(needs) }}
run: |
echo "needs<<EOF" >> $GITHUB_ENV
echo $needs | jq '.[].result = "failure"' >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
echo "steps<<EOF" >> $GITHUB_ENV
echo $steps | jq '.[].outcome = "failure"' >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Check overwrites
env:
steps: ${{ env.steps }}
needs: ${{ env.needs }}
run: |
echo "Needs: $needs"
echo "Steps: $steps"
- name: MSTeams Notification
uses: ./
if: always()
with:
webhook_url: ${{ secrets.MSTEAMS_WEBHOOK }}
needs: ${{ env.needs }}
job: ${{ toJson(job) }}
steps: ${{ env.steps }}
dry_run: ${{ !github.event.action == 'release' }}
- name: Confirm finish
run: |
echo 'MSTeams failure notification succeeded'
without_optional_params:
name: One with little info
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master
- name: MSTeams Notification
uses: ./
if: always()
with:
webhook_url: ${{ secrets.MSTEAMS_WEBHOOK }}
dry_run: ${{ !github.event.action == 'release' }}
with_overwrite:
name: One with overwrite
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master
- name: MSTeams Notification
uses: ./
if: always()
with:
webhook_url: ${{ secrets.MSTEAMS_WEBHOOK }}
overwrite: "{title: `Overwrote title in ${workflow_link}`}"
job: ${{ toJson(job) }}
steps: ${{ toJson(steps) }}
dry_run: ${{ !github.event.action == 'release' }}
with_raw:
name: One with raw data
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master
- name: MSTeams Notification
uses: ./
if: always()
with:
webhook_url: ${{ secrets.MSTEAMS_WEBHOOK }}
raw: >-
{
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
"title": "No ${variables} avaliable in here",
"text": "Lorem ipssum"
}
dry_run: ${{ !github.event.action == 'release' }}