In our github actions workflow we want to rerun tests if the previous tests failed:
We made:
some-smoke-test-result:
name: Parse and analyze test results smoke test
needs: [some-smoke-test]
if: needs.some-smoke-test.outputs.some-id != ''
runs-on: ${{inputs.runner-tag}}
steps:
- name: parse-test-result
id: parse-test-result
uses: some/some-actions/[email protected]
with:
testarena-id: ${{ needs.some-smoke-test.outputs.some-id }}
some-smoke-test-rerun:
name: Rerun some smoke test
needs: [some-smoke-test, some-smoke-test-result]
if: always() && needs.steps.some-smoke-test-result.outcome == 'failure'
However the if statement at the step test-result-smoke-test
is not working as expected, when I only have the always()
statement it is triggered as expected, but I only want to run it when the previous stage fails. For that reason I added && needs.steps.some-smoke-test-result.outcome == 'failure'
However it is not triggering while the previous stage fails.
How should I trigger a stage ONLY if the previous stage failed
note i removed the earlier stages as everything else is working as expected.