Skip to content

Composite Actions fail to overwrite env if it is already set #1899

@thboop

Description

@thboop

Describe the bug
Setting an env that is already set in a composite action causes the value to not be set as expected.
To Reproduce
Setup a composite action

  using: "composite"
  steps:
    - name: set env
      shell: bash
      run: |
        VAR1=$RANDOM
        echo "MY_VAR1=$(echo $VAR1)" >> $GITHUB_ENV
        echo $VAR1
        echo 'create finished'
  
    # Show ref information
    - name: Show ref information
      run: |
          echo 'random1'
          echo $MY_VAR1
          echo 'env-random1'
          echo "${{ env.MY_VAR1 }}"
          echo 'read finished'
      shell: bash

Call it twice locally using uses: ./{path}
Notice the second time the value it reads is incorrect.
Expected behavior
A clear and concise description of what you expected to happen.

Runner Version and Platform

2.291.1 linux

Metadata

Metadata

Labels

Runner BugBug fix scope to the runnerbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions