Closed LukeMondy closed 4 years ago
Hello @LukeMondy ,
What is the behavior that you are looking for?
Your pull request is going to cause a regression back to #4 as without the set -o pipefail
the line html5validator --root "${INPUT_ROOT}" --log "${INPUT_LOG_LEVEL}" ${BuildARGS} |& tee log.log
will alawys return a 0 exit code even if html5validator fails.
Ah, sorry, I didn't look into the closed issues.
I'm looking to use the output result
in later stages, to check to see what the return code is, e.g.: https://github.com/Cyb3r-Jak3/html5validator-action/blob/6a7177075df0b8d88b6930125f5c54f1e41e67ae/.github/workflows/action-test.yml#L43
When the html5validator
finds an issue, it returns a non-zero exit code. In the current state of the code, because of pipefail
being set, this line won't get run:
https://github.com/Cyb3r-Jak3/html5validator-action/blob/6a7177075df0b8d88b6930125f5c54f1e41e67ae/entrypoint.sh#L33
Which means later on, when I check the result
variable, it's unset. It also means more generally that the result
variable will either be 0
or unset, never any other value.
When I remove the pipefail
option, the result
correctly reports an error code (such as 255
).
I do see the issue though - the action may report passing when the html5validator
didn't actually return a 0
exit code. To fix that, we could add:
exit $result
after this line: https://github.com/Cyb3r-Jak3/html5validator-action/blob/6a7177075df0b8d88b6930125f5c54f1e41e67ae/entrypoint.sh#L33
That would still allow the job to fail, but still report the return code in the result
output.
I follow and that makes sense to make sure that this action does work in a better context. I have gone ahead and created those changes (Pull Request #9) and the behavior you are looking for now exists in version v0.4.2.
I am going to close this pull request and once you get a chance to test please let me know.
Having
pipefail
set in theentrypoint.sh
stops failures being reported ifhtml5validator
does actually return a non-zero code.You can see this in the logs from the action-test here: https://github.com/Cyb3r-Jak3/html5validator-action/runs/936410945?check_suite_focus=true
For the "Plain test" step, we see this output:
But for the "Check failure" step, we see this:
Note that the lines after
+ html5validator --root tests/valid/ --log WARNING
in the "Plain test" don't get reported in the "Check Failure" case.Doing a quick test with this PR seemed to give the correct behavior.