Toolkit: Multiline support for Toolkit Annotations

Created on 28 Oct 2019  路  4Comments  路  Source: actions/toolkit

This is a follow-up issue started at https://github.com/actions/toolkit/issues/186#issuecomment-546772099.

It is unclear from the recently added Annotation docs if ::debug/::warning/::error messages support multiline text in the {message} placeholder.

Why it is important? These Annotations can be used by various code linters and other similar tools, but their output easily could be spanned to multiple lines, for example:

pylint output:

W:108: Operator not followed by a space
     print >>sys.stderr, 'Unable to match %r', line
            ^

Rust compiler output:

warning: comparison is useless due to type limits
  --> example/src/lib.rs:20:8
   |
20 |     if pid < 0 {
   |        ^^^^^^^
   |
   = note: `#[warn(unused_comparisons)]` on by default

It would be nice to clarify if it is possible to use multiline strings over there and it is expected to be working correctly in the future.

enhancement

Most helpful comment

It can be achieved by using urlencoded newline %0A in place of \n.

I learned it from a comment by @PoisonousJohn at https://github.com/actions/starter-workflows/issues/68#issuecomment-581479448

I've confirmed it working for PHPUnit output and have a PR: https://github.com/mheap/phpunit-github-actions-printer/pull/14/files

And here's a screenshot of the outcome: https://i.imgur.com/nnSCPTG.png

Zero documentation anywhere, thank you @PoisonousJohn !

All 4 comments

+1 At least some kind of initial feedback. Is it possible or not? And then maybe follow up with updating the docs.

+1. This is one of the last blocking issues blocking me from moving to Github Actions. The output of my test suites failures are much longer than a single line, and I have no way to display them nicely.

It can be achieved by using urlencoded newline %0A in place of \n.

I learned it from a comment by @PoisonousJohn at https://github.com/actions/starter-workflows/issues/68#issuecomment-581479448

I've confirmed it working for PHPUnit output and have a PR: https://github.com/mheap/phpunit-github-actions-printer/pull/14/files

And here's a screenshot of the outcome: https://i.imgur.com/nnSCPTG.png

Zero documentation anywhere, thank you @PoisonousJohn !

I just discovered this, Cheers!
I can confirm it works and have used it successfully in a workflow.

PS. @BrianHenryIE Have you discovered a way to make problem matchers work with multi-line messages?

Was this page helpful?
0 / 5 - 0 ratings