Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 2
Message 1 of 2

Github Actions error reporting as Annotation

Solved! Go to Solution.

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

 

1 Reply
Highlighted
Solution
GitHub Partner
Message 2 of 2

Re: Github Actions error reporting as Annotation

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"

multipleline.png

Hope it helps!