Shipfox
How-to GuidesAuthor Workflows

Pass Output Between Jobs

Pass output from one job to another job in the same workflow.

Use a job output to pass output between jobs. The first job publishes a step output. A dependent job reads it.

Pass output between jobs

# yaml-language-server: $schema=https://www.shipfox.io/docs/workflow.schema.json
name: Pass output between jobs
runner: shipfox

triggers:
  manual:
    source: manual

jobs:
  prepare:
    outputs:
      message: ${{ steps.create_message.outputs.message }}
    steps:
      - key: create_message
        run: echo "message=Hello from the prepare job" >> "$SHIPFOX_OUTPUT"
        outputs:
          message: string

  consume:
    needs: prepare
    steps:
      - env:
          MESSAGE: ${{ jobs.prepare.outputs.message }}
        run: echo "$MESSAGE"

The prepare job publishes the message step output. The consume job depends on prepare and reads the job output.

Verify the output

Start the workflow

Select Run, then open the new run.

Compare the output

Open prepare and confirm that its outputs include message. Open consume and confirm that its log contains Hello from the prepare job.

See Step outputs for declaration types and encoding. See Job outputs for size limits.

Was this page helpful?
Edit this page on GitHub

On this page