-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathentrypoint.sh
executable file
·69 lines (66 loc) · 2.33 KB
/
entrypoint.sh
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
#!/bin/sh -l
# Prepare the JSON payload
json_payload=$(cat << EOF
{
"type": "message",
"attachments": [
{
"contentType": "application/vnd.microsoft.card.adaptive",
"contentUrl": null,
"content": {
"\$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.2",
"body": [
{
"type": "TextBlock",
"text": "${MESSAGE}"
},
{
"type": "FactSet",
"facts": [
{
"title": "Initiated By:",
"value": "${INITIATOR}"
},
{
"title": "Branch:",
"value": "${BRANCH_NAME}"
},
{
"title": "Deployment URL:",
"value": $([ -n "${DEPLOYMENT_URL}" ] && echo '"'${DEPLOYMENT_URL}'"' || echo '"Not set. Set the repository secret [BRANCH_NAME]_DEPLOYMENT_URL to enable."')
}
]
}
],
"actions": [
{
"type": "Action.OpenUrl",
"title": "View Progress",
"url": "${PROGRESS_URL}"
}
$([ -n "${DEPLOYMENT_URL}" ] && echo ',
{
"type": "Action.OpenUrl",
"title": "View Site",
"url": "'${DEPLOYMENT_URL}'"
}' || echo ',
{
"type": "Action.OpenUrl",
"title": "Setup Deployment URL",
"url": "'${VARIABLE_SETUP_URL}'"
}')
]
}
}
]
}
EOF
)
# Send the curl request
response=$(curl --location "${TEAMS_WEBHOOK_URL}" \
--header 'Content-Type: application/json' \
--data "$json_payload")
# Set the output
echo "::set-output name=http_response::$response"