-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
66 lines (58 loc) · 1.97 KB
/
action.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
name: "Notify Statuscope"
description: "Notify statuscope of the Job-Result"
inputs:
repository:
description: "Repository that the action is being run in"
required: true
test_result:
description: "Result of the Test-Run to report to statuscope"
required: true
url:
description: "URL to heartbeat-application, e.g. https://status.example.com"
required: true
token:
description: "Token provided by statuscope"
required: true
# jobs:
# notify-statuscope:
# runs-on: 'ubuntu-latest'
# env:
# HEARTBEAT_URL: ${{ secrets.HEARTBEAT_URL }}
# HEARTBEAT_TOKEN: ${{ secrets.HEARTBEAT_TOKEN }}
runs:
using: composite
steps:
- name: 'Check Configuration'
shell: bash
run: |
HEARTBEAT_APPLICATION="$(basename "${inputs.repository}-tests" | tr _ -)"
HEARTBEAT_TOKEN="${inputs.token}" >> $GITHUB_ENV
HEARTBEAT_URL="${inputs.url}" >> $GITHUB_ENV
echo "HEARTBEAT_APPLICATION=${HEARTBEAT_APPLICATION}" >> $GITHUB_ENV
echo "HEARTBEAT_TOKEN=${HEARTBEAT_TOKEN}" >> $GITHUB_ENV
echo "HEARTBEAT_URL=${HEARTBEAT_URL}" >> $GITHUB_ENV
echo "HEARTBEAT_APPLICATION is $HEARTBEAT_APPLICATION"
(
[[ "$HEARTBEAT_URL" != '' ]] &&
[[ "$HEARTBEAT_TOKEN" != '' ]] &&
echo "HEARTBEAT_URL and HEARTBEAT_TOKEN are present."
) || (
echo "Please ensure that you have HEARTBEAT_URL and HEARTBEAT_TOKEN set as secrets"
exit 1
)
- name: 'Send success'
shell: bash
if: ${{ inputs.test_result == true }}
run: >
curl -v $HEARTBEAT_URL/signal \
-d application=$HEARTBEAT_APPLICATION \
-d token=$HEARTBEAT_TOKEN \
-d status=ok | jq .
- name: 'Send failure'
shell: bash
if: ${{ inputs.test_result == false }}
run: >
curl -v $HEARTBEAT_URL/signal \
-d application=$HEARTBEAT_APPLICATION \
-d token=$HEARTBEAT_TOKEN \
-d status=fail | jq .