How to pass a precondition value for a job in GitHub Actions
22:58 29 May 2023

I want to pass a value from a job to another. The output will be a precondition for the next job so if the value will be false the next job will not run.

I've seen that there is a solution for this with ::set-output, but this feature will be deprecated.

I want to achieve something like this:

jobs:
  check-version:
    runs-on: ubuntu-latest
    steps:
        if: ${{ condition }}
        run: |
          echo "::set-output name=CONTINUE::false"

  deploy:
    if: ${{ needs.check-version.outputs.CONTINUE != 'false' }}
    needs: [check-version]
    runs-on: ubuntu-latest
    steps:
      - run: echo "The job is running"
github github-actions jobs