-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Allow passed in env vars to supersede ones declared in the workflow #1100
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1100 +/- ##
==========================================
+ Coverage 57.50% 60.01% +2.50%
==========================================
Files 32 39 +7
Lines 4594 4924 +330
==========================================
+ Hits 2642 2955 +313
+ Misses 1729 1727 -2
- Partials 223 242 +19
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
I think changing the order of parameters from rc.Env = mergeMaps(rc.Config.Env, rc.Run.Workflow.Env, rc.Run.Job().Environment()) to rc.Env = mergeMaps(rc.Run.Workflow.Env, rc.Run.Job().Environment(), rc.Config.Env) would be simpler, wouldn't it? Can you try that instead of testing for existence? |
Yeah that's a better way, idk why I didn't think of that, will push that up. Thanks! |
@liamphmurphy this pull request has failed checks 🛠 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Simple approach to allowing for #1098
Since
act/pkg/runner/run_context.go
Line 78 in b3bd268
rc.Config.env
is the first map to iterate through (which is what contains any variables passed into act from the CLI), this simple duplicate check works for not letting the values of an env var in the workflow supersede what is passed into the CLI or env-files.Added a few tests as well, please let me know if anything should be adjusted.