name: Conditional Steps # Name of workflow on: workflow_dispatch: jobs: example_job: runs-on: ubuntu-latest steps: - name: Step 1 - Exit Code 0 id: successful_step run: | echo "exit code 0" exit 0 # Success (exit code 0) shell: bash # If you want you can change the shell per step - name: Step 2 - Execute If Previous Succeeded # The syntax bellow ${{}} is expression syntax in github actions # Success and failure are status expressions if: ${{ success() }} # Only run this step if the previous step succeeded run: | echo "Running because the previous step has succeeded" - name: Step 3 - I am Failing run: | echo "I am failing" exit 1 # Failure (non-zero exit code) - name: Step 4 - I Will Never Execute # Because of failure of Step 3 run: | echo "I will never execute" - name: Step 5 - Execute on Workflow Failure if: ${{ failure() }} # Only run this step if the workflow failed run: | echo "Workflow failed"