Skip to content

Adjust error message parsing for the new syntax test output format #24

@FichteFoll

Description

@FichteFoll

The syntax test output format has changed via sublimehq/sublime_text#3022.

Here is some example output (via):

Data path: /home/runner/work/syntax-test-action/syntax_tests/Data
Cache path: /home/runner/work/syntax-test-action/syntax_tests/Data/Cache
Packages path: /home/runner/work/syntax-test-action/syntax_tests/Data/Packages
Running: /home/runner/work/syntax-test-action/syntax_tests/Data/Packages/syntax-test-action/syntax_test_js.js
/home/runner/work/syntax-test-action/syntax_tests/Data/Packages/syntax-test-action/syntax_test_js.js:8:8
error: scope does not match
8 |        param
9 | //     ^^^^^ - variable.parameter.function.js
|        ^^^^^ these locations did not match
actual:
|        ^^^^^ source.js meta.function.parameters.js meta.binding.name.js variable.parameter.function.js

(leading whitespace is stripped, presumably by the log display)

Previously, the error message was on the same line as the rest of the metadata (file name, col, row) and I'm not sure currently if the ::error reporting can handle multiple lines.

Code that needs updating:

if [[ "$line" == "$packages/$INPUT_PACKAGE_NAME/"* ]]; then
IFS=$':' read -r path row col message <<< "$line"
file="${path/$packages\/$INPUT_PACKAGE_NAME/$INPUT_PACKAGE_ROOT}"
# https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-error-message
echo "::error file=$file,line=$row,col=$col::${message# }"
fi

The updated logic also needs to be conditional since the format has began with build 4181.

Documentation: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions