Skip to content

Commit 0013b58

Browse files
committed
Collect lines with more details
The entire message is already re-printed by GitHub itself, so I added a comment for that.
1 parent 98c66ee commit 0013b58

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

syntax-tests.sh

+18-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,10 @@ check_syntax_test_filenames() {
153153

154154
parse_test_results() {
155155
while IFS='' read -r line; do
156+
# Reprint this line to make it visible in the logs.
157+
# Not necessary for the lines we include in the message segment below.
156158
echo "$line"
159+
157160
### Before 4181
158161
# /home/runner/work/syntax-test-action/syntax_tests/Data/Packages/syntax-test-action/test/defpkg/syntax_test_test:7:1: [source.python constant.language] does not match scope [text.test]
159162

@@ -165,11 +168,25 @@ parse_test_results() {
165168
# | ^^^^^ these locations did not match
166169
# actual:
167170
# | ^^^^^ source.js meta.function.parameters.js meta.binding.name.js variable.parameter.function.js
171+
#
172+
# (error blocks are then terminated by a blank line)
168173
if [[ "$line" == "$packages/$INPUT_PACKAGE_NAME/"* ]]; then
169174
IFS=$':' read -r path row col message <<< "$line"
170175
file="${path/$packages\/$INPUT_PACKAGE_NAME/$INPUT_PACKAGE_ROOT}"
176+
171177
if (( $build >= 4181 )); then
172-
IFS=$':' read -r logtype message
178+
IFS='' read -r msg_line
179+
IFS=$':' read -r logtype message <<< "$msg_line"
180+
181+
# Collect lines with more details until the next blank line
182+
while IFS='' read -r detail_line; do
183+
if [ -z "$detail_line" ]; then
184+
break
185+
fi
186+
# Using a percent-encoded newline ('%0A') works as a line break
187+
# via https://github.com/actions/toolkit/issues/193
188+
message="$message%0A$detail_line"
189+
done
173190
fi
174191
# https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-error-message
175192
echo "::${logtype:-error} file=$file,line=$row,col=$col::${message# }"

0 commit comments

Comments
 (0)