Is any way to use first_job's some step's output in second_job ?

simple example, how to get first_job’s createoutput’s OUT?

jobs:
  first_job:
    runs-on: ubuntu-latest
    name: create output
    steps:
      - name: create output
        id: createoutput
        run: |
          echo ::set-output name=OUT::$(date)
   second_job:
      runs-on: ubuntu-latest
      name: use out
      env:
          OUT: $${{ first_job.createoutput.OUT}}

Hi @yjcn ,

It’s not supported to share data between different jobs with ‘set-ouput’ result.

As an alternative, you can use the upload-artifact and download-artifact actions to share data between jobs in a workflow. 

Please refer to the official doc and sample here for more details, thanks.

1 Like

:wave: Hi @yjcn

Workflow syntax for GitHub Actions provides this example of how to use an output from first_job in second_job:

jobs:
  job1:
    runs-on: ubuntu-latest
    # Map a step output to a job output
    outputs:
      output1: ${{ steps.step1.outputs.test }}
      output2: ${{ steps.step2.outputs.test }}
    steps:
      - id: step1
        run: echo "::set-output name=test::hello"
      - id: step2
        run: echo "::set-output name=test::world"
  job2:
    runs-on: ubuntu-latest
    needs: job1
    steps:
      - run: echo ${{needs.job1.outputs.output1}} ${{needs.job1.outputs.output2}}