Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
24925a17
Unverified
Commit
24925a17
authored
Apr 22, 2020
by
Honza Hommer
Browse files
feat: add default colors
parent
74cdcde4
Changes
1
Hide whitespace changes
Inline
Side-by-side
notify/teams.sh
View file @
24925a17
...
@@ -14,6 +14,10 @@ teams_send() {
...
@@ -14,6 +14,10 @@ teams_send() {
_statusCode
=
"
$3
"
#0: success, 1: error 2($RENEW_SKIP): skipped
_statusCode
=
"
$3
"
#0: success, 1: error 2($RENEW_SKIP): skipped
_debug
"_statusCode"
"
$_statusCode
"
_debug
"_statusCode"
"
$_statusCode
"
_color_success
=
"2cbe4e"
# green
_color_danger
=
"cb2431"
# red
_color_muted
=
"586069"
# gray
TEAMS_WEBHOOK_URL
=
"
${
TEAMS_WEBHOOK_URL
:-
$(
_readaccountconf_mutable TEAMS_WEBHOOK_URL
)
}
"
TEAMS_WEBHOOK_URL
=
"
${
TEAMS_WEBHOOK_URL
:-
$(
_readaccountconf_mutable TEAMS_WEBHOOK_URL
)
}
"
if
[
-z
"
$TEAMS_WEBHOOK_URL
"
]
;
then
if
[
-z
"
$TEAMS_WEBHOOK_URL
"
]
;
then
TEAMS_WEBHOOK_URL
=
""
TEAMS_WEBHOOK_URL
=
""
...
@@ -49,16 +53,20 @@ teams_send() {
...
@@ -49,16 +53,20 @@ teams_send() {
case
"
$_statusCode
"
in
case
"
$_statusCode
"
in
0
)
0
)
_color
=
"
$TEAMS_SUCCESS_COLOR
"
_color
=
"
$
{
TEAMS_SUCCESS_COLOR
:-
$_color_success
}
"
;;
;;
1
)
1
)
_color
=
"
$TEAMS_ERROR_COLOR
"
_color
=
"
$
{
TEAMS_ERROR_COLOR
:-
$_color_danger
}
"
;;
;;
2
)
2
)
_color
=
"
$TEAMS_SKIP_COLOR
"
_color
=
"
$
{
TEAMS_SKIP_COLOR
:-
$_color_muted
}
"
;;
;;
esac
esac
_color
=
"
$(
echo
"
${
_color
:-
$TEAMS_THEME_COLOR
}
"
|
tr
-cd
'a-fA-F0-9'
)
"
_color
=
$(
echo
"
$_color
"
|
tr
-cd
'a-fA-F0-9'
)
if
[
-z
"
$_color
"
]
;
then
_color
=
$(
echo
"
${
TEAMS_THEME_COLOR
:-
$_color_muted
}
"
|
tr
-cd
'a-fA-F0-9'
)
fi
_data
=
"{
\"
title
\"
:
\"
$_subject
\"
,"
_data
=
"{
\"
title
\"
:
\"
$_subject
\"
,"
if
[
-n
"
$_color
"
]
;
then
if
[
-n
"
$_color
"
]
;
then
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment