I am converting a Jenkins declarative pipeline into a GitHub Actions workflow. We rely on the following bit of code in the pipeline to override the status of our Protractor test stage by checking the output of a series of txt files with booleans in for whether a scenario passed or failed:
} catch (err) {
testFlags = sh(script:'cat *result.flag.txt', returnStdout: true).trim()
if (testFlags.contains('true')) {
println "A test failure exists - build status updated to failure"
currentBuild.result = 'FAILURE'
error "Test(s) have failed"
}
else {
println "No test failures exist - build status updated to success"
I am trying to figure out a way to do something similar in a Github Actions .yml file? The code for generating the txt files is the same and I believe is working.
The reason we need to do this is due to a bug with Cucumber.js where even if a Scenario fails once then passes on retry the exit code is still 1. So we have to override it and set the flag files for each test.