name: Passing Data Between Jobs

on:
  workflow_dispatch:

jobs:
  data-sender:
    runs-on: ubuntu-22.04
    steps:
      - name: Create data
        id: sender # Set the output name for this step to Apple
        run: |
          echo "name=Apple" >> $GITHUB_OUTPUT
    outputs:
      name: ${{ steps.sender.outputs.name }}

  data-receiver:
    runs-on: ubuntu-22.04
    needs: ["data-sender"] 
    steps: # In order to have data for receiver sender needs to first produce some data.
      - name: Receive data
        # Notice how we use needs object to access the sender job's outputs
        run: |
          echo ${{ needs.data-sender.outputs.name }} 