[Bug] Workflow logging commands

This bug report relates to workflow commands such as ::warning:: and ::error::.

Description

Create a workflow which outputs the following to stdout:

::error::[ERROR] /root/foo.java:7:2: 'import' has incorrect indentation level 1, expected level should be 0. [Indentation]

Expected

Highlighted entry in the log file showing:

Error: [ERROR] /root/foo.java:7:2: 'import' has incorrect indentation level 1, expected level should be 0. [Indentation]

Actual

/root/foo.java:7:2: 'import' has incorrect indentation level 1, expected level should be 0. [Indentation]

(the [ERROR] tag is missing).

Additional Info

In the raw workflow log, it shows the following:

2021-07-25T01:33:42.9439808Z ##[error][ERROR] /root/foo.java:7:2: 'import' has incorrect indentation level 1, expected level should be 0. [Indentation]

If something is added before the [ERROR] tag, e.g.

::error::Something [ERROR] /root/foo.java:7:2: 'import' has incorrect indentation level 1, expected level should be 0. [Indentation]

then it still does not work. For the above example, the output was

Error: ng [ERROR] /root/foo.java:7:2: 'import' has incorrect indentation level 1, expected level should be 0. [Indentation]

I don’t think that the text clearly defines the outcome. I think it’s reasonable to ask the documentation be improved.
https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-error-message

I’m not sure if this is a documentation issue, but rather a bug. The last example shows that it seems like the first few characters are always truncated.

The last example is a bug. File it:

Frustratingly, I can’t easily find the code that’s doing the work. – I have a guess as to what it’s doing, but searching for error is not fun.

I personally don’t think the general behavior is sufficiently documented.

For the curious, the code path is roughly: