File tree Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change 3
3
# Prints the given message to stderr
4
4
function echoerr() {
5
5
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#setting-an-error-message
6
- # Support multi-line strings by replacing line separator with GitHub Actions compatible one
7
- echo " ::error::ERROR - ${*// $' \n ' /% 0A} " 1>&2 ;
6
+ __log " error" " ERROR - " " ${* } "
8
7
}
9
8
10
9
# Prints the given message as a warning
11
10
function echowarning() {
12
11
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#setting-a-warning-message
13
- echo " :: warning:: $* " 1>&2 ;
12
+ __log " warning" " ${ * } "
14
13
}
15
14
16
15
# Prints the given message as a notice
17
16
function echonotice() {
18
17
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#setting-a-notice-message
19
- echo " :: notice:: $* " 1>&2 ;
18
+ __log " notice" " ${ * } "
20
19
}
21
20
22
21
# Prints the given message to debug logs, _if enabled_
23
22
function echodebug() {
24
23
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#setting-a-debug-message
25
- echo " :: debug:: $* " 1>&2 ;
24
+ __log " debug" " ${ * } "
26
25
}
27
26
28
27
# Create group
29
28
function echo_group() {
30
29
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#grouping-log-lines
31
- local TITLE=$1
32
- echo " ::group::${TITLE} "
30
+ __log " group" " ${* } "
33
31
}
34
32
35
33
# Ends group after calling echo_group()
36
34
function echo_group_end() {
37
35
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#grouping-log-lines
38
- echo " ::endgroup::"
36
+ __log " endgroup"
37
+ }
38
+
39
+ function __log() {
40
+ local level=${1}
41
+ shift
42
+ local message=${* }
43
+
44
+ # Support multi-line strings by replacing line separator with GitHub Actions compatible one
45
+ echo " ::${level} ::${message// $' \n ' /% 0A} " 1>&2
39
46
}
You can’t perform that action at this time.
0 commit comments