Skip to content

Commit 4df8006

Browse files
committed
2022.08.18:
* fixed: bash/github: init-print-workflow.sh, print-*.sh: execution fixup
1 parent 0bc9661 commit 4df8006

File tree

5 files changed

+34
-5
lines changed

5 files changed

+34
-5
lines changed

bash/github/init-print-workflow.sh

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,11 @@ function gh_print_annotation()
118118
local msg="$3"
119119

120120
#gh_decode_line_return_chars "$msg"
121-
RETURN_VALUE="${RETURN_VALUE//%0D%0A/$'\r\n'\| }"
121+
msg="${msg//%0D%0A/$'\r\n'\| }"
122122

123-
# stdout redirection must be issued outside
123+
# NOTE:
124+
# The stdout redirection must be issued outside.
125+
#
124126
echo "::$annot_type $annot_prefix::$msg"
125127

126128
gh_process_annotation_print "$annot_type" "$annot_prefix" "$msg"
@@ -129,6 +131,24 @@ function gh_print_annotation()
129131
gh_set_env_var GHWF_ANNOTATIONS_PRINT_BUF_STR "${GHWF_ANNOTATIONS_PRINT_BUF_STR}${GHWF_ANNOTATIONS_PRINT_BUF_STR:+"${RETURN_VALUES[0]}"}${RETURN_VALUES[1]}"
130132
}
131133

134+
function gh_print_annotation_line()
135+
{
136+
[[ -z "$GITHUB_ACTIONS" ]] && return 0
137+
138+
local line="$1"
139+
140+
#gh_decode_line_return_chars "$msg"
141+
line="${line//%0D%0A/$'\r\n'\| }"
142+
143+
# NOTE:
144+
# The stdout redirection must be issued outside.
145+
#
146+
echo "$line"
147+
148+
# duplicate output into `GHWF_ANNOTATIONS_PRINT_BUF_STR` variable to reuse later
149+
gh_set_env_var GHWF_ANNOTATIONS_PRINT_BUF_STR "${GHWF_ANNOTATIONS_PRINT_BUF_STR}${GHWF_ANNOTATIONS_PRINT_BUF_STR:+$'\r\n'}$line"
150+
}
151+
132152
function gh_flush_print_annotations()
133153
{
134154
local IFS

bash/github/print-error.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ function gh_print_errors_buffer()
131131
{
132132
local buf="$1"
133133

134+
[[ -z "$buf" ]] && return 0
135+
134136
local line
135137

136138
# with check on integer value
@@ -143,7 +145,7 @@ function gh_print_errors_buffer()
143145
# fix multiline text in a single argument
144146
gh_encode_line_return_chars "$RETURN_VALUE"
145147

146-
gh_print_annotation error '' "$RETURN_VALUE"
148+
gh_print_annotation_line "$RETURN_VALUE"
147149
done >&2
148150
else
149151
gh_print_args "$buf" >&2

bash/github/print-notice.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ function gh_print_notices_buffer()
131131
{
132132
local buf="$1"
133133

134+
[[ -z "$buf" ]] && return 0
135+
134136
local line
135137

136138
# with check on integer value
@@ -143,7 +145,7 @@ function gh_print_notices_buffer()
143145
# fix multiline text in a single argument
144146
gh_encode_line_return_chars "$RETURN_VALUE"
145147

146-
gh_print_annotation notice '' "$RETURN_VALUE"
148+
gh_print_annotation_line "$RETURN_VALUE"
147149
done
148150
else
149151
gh_print_args "$buf"

bash/github/print-warning.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ function gh_print_warnings_buffer()
131131
{
132132
local buf="$1"
133133

134+
[[ -z "$buf" ]] && return 0
135+
134136
local line
135137

136138
# with check on integer value
@@ -143,7 +145,7 @@ function gh_print_warnings_buffer()
143145
# fix multiline text in a single argument
144146
gh_encode_line_return_chars "$RETURN_VALUE"
145147

146-
gh_print_annotation warning '' "$RETURN_VALUE"
148+
gh_print_annotation_line "$RETURN_VALUE"
147149
done >&2
148150
else
149151
gh_print_args "$buf" >&2

changelog.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2022.08.18:
2+
* fixed: bash/github: init-print-workflow.sh, print-*.sh: execution fixup
3+
14
2022.08.16:
25
* changed: bash/github/accum-rate-limits.sh: removed usage of a print annotation group because works as not expected (a print does truncate by first `\n` characters and the `%0A` sequence does not work as line return in the job summary annotations)
36

0 commit comments

Comments
 (0)