Answers: <h1>No</h1>
  <p>In the following snipped the <code>get_env</code> job will return <code>12345</code>.</p>
  <pre class="lang-yaml prettyprint-override"><code>env:
    my_output: 12345
  
  jobs:
    set_env:
      runs-on: ubuntu-latest
      steps:
        - name: Set Output
          id: step1
          run: echo &quot;my_output=77foobar77&quot; &gt;&gt; &quot;$GITHUB_ENV&quot;
        - name: Use Output
          run: echo &quot;${{ env.my_output }}&quot;
  
    get_env:
      needs: set_env
      runs-on: ubuntu-latest
      steps:
        - name: Use Output
          run: echo &quot;${{ env.my_output }}&quot;
  </code></pre>
  
Answers: CC BY-SA 4.0
Answers: 2024-11-15T14:55:56.900Z
Answers: 2024-11-15T14:55:56.900Z
Answers: Evan Carroll
Body: <p>If two jobs <code>foo</code> and <code>bar</code> are created in GitHub Actions and <code>bar</code> <code>needs:</code> <code>foo</code>, will <code>bar</code> see the writes to <code>$GITHUB_ENV</code> that <code>foo</code> did? Will it then &quot;inherit&quot; that environment?</p>
  
Tags: <github-actions>
Title: Do writes to "$GITHUB_ENV" persist across jobs you depend on which fire before you?
UserDisplayName: Evan Carroll
ThreadText: # Do writes to "$GITHUB_ENV" persist across jobs you depend on which fire before you?
  
  (Asked by: username_0 on 2024-11-15)
  
  If two jobs `foo` and `bar` are created in GitHub Actions and `bar` `needs:` `foo`, will `bar` see the writes to `$GITHUB_ENV` that `foo` did? Will it then "inherit" that environment?
  
  **Tags:** github-actions
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2024-11-15. Score: 0
  
  # No
  
  In the following snipped the `get_env` job will return `12345`.
  
  ```yaml
  env:
    my_output: 12345
  
  jobs:
    set_env:
      runs-on: ubuntu-latest
      steps:
        - name: Set Output
          id: step1
          run: echo "my_output=77foobar77" >> "$GITHUB_ENV"
        - name: Use Output
          run: echo "${{ env.my_output }}"
  
    get_env:
      needs: set_env
      runs-on: ubuntu-latest
      steps:
        - name: Use Output
          run: echo "${{ env.my_output }}"
  
  ```
  
  
  ---
  
  