Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a github workflow error message show up in log and annotations?

I have a workflow step that runs this last stage of a shell command in a loop:

|| echo "::error Filename $filename doesn't match possible files" && exit 1 ; done

The exit is triggered appropriately, but the only annotation I see is:

Error: Process completed with exit code 1.

The log shows the entire shell command pipeline and also that same error message, but not my echo'd error.

How do I get my output, including the $filename variable, included?

like image 417
James Wetterau Avatar asked Jan 01 '26 06:01

James Wetterau


1 Answers

You have the wrong syntax:

echo "::error::Filename $filename doesn't match possible files"

You need to postfix error with ::

Here is a working workflow:

There must be something else wrong with your workflow if it doesn't work - other command is exiting with code 1 before it has a chance to execute.

like image 90
Grzegorz Krukowski Avatar answered Jan 02 '26 20:01

Grzegorz Krukowski



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!