Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: GITHUB_ENV in composite #1794

Merged
merged 5 commits into from
Jun 29, 2022

Conversation

ChristopherHX
Copy link
Contributor

@ChristopherHX ChristopherHX commented Mar 29, 2022

This PR just shows how you could fix issue #789. This doesn't includes any tests and I'm not affiliated with GitHub.

Minimal repro of the bug, which this change aims to solve.
action.yml

runs:
  using: composite
  steps:
  - run: echo "myenvvar=val2" > $GITHUB_ENV
    shell: bash
  # The following step fails on actions/runner prior these changes
  - run: exit 1
    if: env.myenvvar != 'val2'
    shell: bash

.github/workflows/main.yml

on: push
jobs:
  test:
    runs-on: [self-hosted, linux]
    steps:
    - uses: actions/checkout@v3
    - run: echo "myenvvar=val1" > $GITHUB_ENV
      shell: bash
    - uses: ./

You see that myenvvar isn't specified as an env parameter of uses: ./, so the env variable should be updated within composite. Actually the actions/runner runs it like the workflow would be, which is expected to always fail
.github/workflows/main.yml

on: push
jobs:
  test:
    runs-on: [self-hosted, linux]
    steps:
    - uses: actions/checkout@v3
    - run: echo "myenvvar=val1" > $GITHUB_ENV
      shell: bash
    - uses: ./
      env:
        myenvvar: val1

The problem is that the composite step env context is already merged with the old global variable set by GITHUB_ENV.

CC @nikola-jokic
Resolves #789
Resolves #1899

@ChristopherHX ChristopherHX requested a review from a team as a code owner March 29, 2022 14:51
@pragmaticivan
Copy link

Howdy! Anyone could take a look and expedite the review for that PR?

@pragmaticivan
Copy link

🙏🏼 @thboop @yaananth @soelinn

@ruvceskistefan
Copy link
Collaborator

Hi @ChristopherHX,
I don't think that this PR solves the problem. If you try to execute workflow described in this issue, you'll see that the same thing is still happening.

@ChristopherHX
Copy link
Contributor Author

ChristopherHX commented May 23, 2022

@ruvceskistefan How did you test it? I created a public run and it works.

Steps I did

Here a public repro, which did work for me

Here another run, one job with ubuntu-latest ( including the bug ) and the other one with the patched runner https://github.com/ChristopherHX/newcomposite-sample/actions/runs/2373814906.

@ruvceskistefan
Copy link
Collaborator

@ChristopherHX you're definitely right, I accidentally tested using runner without --disableupdate. I can confirm that this is working properly, so it is legitimate as far as I'm concerned. I think we'll merge this soon, thanks for your contribution!

@bauergeorg
Copy link

@ruvceskistefan what is the current state?

@ghost
Copy link

ghost commented Jun 2, 2022

@ruvceskistefan Is there any chance someone from GH could merge this PR soon? the tech debt is growing by the day and we will need to remove a lot of the workarounds we've created.

@DonDebonair
Copy link

Can this PR be reviewed and merged?

@sagi-shimoni
Copy link

Please merge this PR soon ,
We are making a lot of workarounds due to this issue...

@dodwmd
Copy link

dodwmd commented Jun 27, 2022

+1

Copy link
Collaborator

@thboop thboop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks for the contribution!

@thboop thboop merged commit 7e74f8c into actions:main Jun 29, 2022
@thboop
Copy link
Collaborator

thboop commented Jun 29, 2022

Thanks for your patience while we evaluated the options to solve this problem. I've gone ahead and merged this PR, it will rollout in the next runner release, which should occur in a few weeks! 🎉

@bauergeorg
Copy link

@thboop Do you know when the next version will be released?

@tlsimmons88
Copy link

@thboop When is this fix going to be released. As of Aug 1, 2022 I am still seeing the issue.

@bauergeorg
Copy link

thanks for release 2.295.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
9 participants