Github Actions error reporting as Annotation

Hi folks,

I’m currently formatting failures of RSpec to set error messages as described on the reference page.

Currently, there is only the possibility to do this in one line because when I use

/n

in my code it’s not picked up by Github Actions.

Is there a way to do this multiline instead of making use of the Github Checks/Annotations API?

Otherwise, it would be a nice feature in the future to make this possible.

Cheers,

Stefan Gies

Hi @gieforce ,

You can replace ‘/n’ with ‘%0A’ for mutliple strings output. Code sample as below:

steps:
      - name: error log
        run: |
          text="This is error1\nThis is error2"
          text="${text//'\n'/'%0A'}" #replace '\n' with '%0A'
          echo $text
          echo "::error file=app.js,line=10,col=15::$text"

Hope it helps!

1 Like