Consider a job with two tests, one failing one succeeding:
name: misc on: [push] jobs: setup: runs-on: ubuntu-latest steps: - shell: bash run: | echo "hello world" test: runs-on: ubuntu-latest needs: setup steps: - shell: bash run: | exit 0 fail: runs-on: ubuntu-latest needs: setup steps: - shell: bash run: | exit 1 cleanup: runs-on: ubuntu-latest needs: [test, fail] if: always() steps: - name: Cleanup run: echo "cleanup needed"
How do I ensure cleanup job always runs? I understand always() only works on step level. I guess I could do a mutex after each step, but that’s mad lot of yaml. I could use
continue-on-error, but that means the test will have green checkmark which is not really wanted…
Edit: Updated with valid syntax… Delete post if needed.