Print a warning annotation
Print ::warning file=...,line=...::message from a step to show an annotation on the run and in the pull request diff. Newlines in the text must be encoded.
A script finds a problem that should not fail the build, and a line in a log nobody opens will be missed.
echo "::warning::disk usage is above 80 percent"
echo "::warning file=src/app.sh,line=12,title=Slow query::query took 3.2 seconds"
msg=$'first line\nsecond line'
msg=${msg//$'\n'/%0A}
echo "::warning::$msg"::warning::disk usage is above 80 percent
::warning file=src/app.sh,line=12,title=Slow query::query took 3.2 seconds
::warning::first line%0Asecond lineA line that starts with ::warning is a workflow command: the runner removes it from the log and creates an annotation, shown in the run summary. With file and line the annotation is attached to that line of the pull request diff, and title adds a heading, according to the workflow commands reference. The text ends at the end of the line, so a newline has to be written as %0A, as the last command does, and a percent sign as %25.
Outside the runner the lines print as they are, as above. ::error:: and ::notice:: take the same properties, and an error annotation does not fail the step by itself, so exit non-zero as well. GitHub caps how many annotations it shows per step, so a loop over many files may be cut off.