Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 3
Message 1 of 4

Env variables in uses

Solved! Go to Solution.

It would be nice to be able to use enviornmental variables in a uses varaible. This will allow for easy changing of versions for actions such as checkout.

 

name: svt-av1
on: [push, pull_request]
env:
  checkout: 'actions/checkout@v2

jobs:
  build:
    runs-on: ubuntu-18.04
    steps:
    - uses: ${{ env.checkout }}
      with:
        fetch-depth: 1
3 Replies
Highlighted
Solution
GitHub Staff
Message 2 of 4

Re: Env variables in uses

In order to enact policies like only using actions defined in the org or repo we can't allow actions to dynamically change at runtime.  So using any sort of dynamic value in uses is not something we will be able to support.

Highlighted
Copilot Lvl 3
Message 3 of 4

Re: Env variables in uses

This makes it more work to update multiple jobs to a newer version of an action or even different workflows since you could in theory just have the maintainers put the versions in a github secret and call it on all their workflows and update everything at once though i think its still better to just do it as a global env variable in the script so it is easier to see and modify in pull requests. If you do not thing this is something that will ever be support then i guess we can go ahead and mark this as solved then.

Highlighted
Ground Controller Lvl 1
Message 4 of 4

Re: Env variables in uses

Hi,

On every push, I want to create a release. I can't figure out how to use the runtime variable $env:NBGV_SimpleVersion there. Any idea? I tried so many version, but no luck.

If I don't put a version, the step will fail because the tag name will be already exist on the next run.

In that image, I want to replace the HERE_VERSION with $env:NBGV_SimpleVersion which is set by the step aarnott/nbgv@v0.3
Image



Thanks