Skip to content

Cancelling rest of job if condition is met. #25280

Discussion options

You must be logged in to vote

@blackswan2019 ,

We have no the “cancel rest of job” command.
As a workaround, you can try using the needs and if conditional on the subsequent jobs to meet your requests.
A simple demo:

jobs:
  job01:
    name: Job 01
    runs-on: ubuntu-latest
    outputs:
      run_rest_jobs: ${{ steps.set_output.outputs.run_jobs }}
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          fetch-depth: 2
  - name: git diff and set output
    id: set_output
    run: |
      codeChanges="only within certain files"
      if [[$codeChanges == "only within certain files"]]; then
        echo "::set-output name=run_jobs::true"
      else
        echo "::set-output name=run_j…

Replies: 9 comments

Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
5 participants