[PR #1100] [MERGED] Allow passed in env vars to supersede ones declared in the workflow #1775

Closed
opened 2026-03-01 21:52:38 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/nektos/act/pull/1100
Author: @liamphmurphy
Created: 4/2/2022
Status: Merged
Merged: 4/4/2022
Merged by: @mergify[bot]

Base: masterHead: master


📝 Commits (5)

  • 92ad657 don't merge env var if it exists already
  • 5ea04fc remove test workflow
  • 7c3678b add some tests
  • 41e3427 change mergeMaps order instead of checking for existence
  • af7a936 Merge branch 'master' into master

📊 Changes

2 files changed (+52 additions, -1 deletions)

View changed files

📝 pkg/runner/run_context.go (+1 -1)
📝 pkg/runner/run_context_test.go (+51 -0)

📄 Description

Simple approach to allowing for #1098

Since github.com/nektos/act@b3bd268e45/pkg/runner/run_context.go (L78) specifies that the 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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/nektos/act/pull/1100 **Author:** [@liamphmurphy](https://github.com/liamphmurphy) **Created:** 4/2/2022 **Status:** ✅ Merged **Merged:** 4/4/2022 **Merged by:** [@mergify[bot]](https://github.com/apps/mergify) **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (5) - [`92ad657`](https://github.com/nektos/act/commit/92ad65750371a8e5cdab0273271d66bc269f9750) don't merge env var if it exists already - [`5ea04fc`](https://github.com/nektos/act/commit/5ea04fc44076f0628b4e70cc880cb10e85fe967f) remove test workflow - [`7c3678b`](https://github.com/nektos/act/commit/7c3678b932a1b2ebbc91468beaf2e2ae4e8a946e) add some tests - [`41e3427`](https://github.com/nektos/act/commit/41e3427ca8c6988e9e109cb20cccf96aa4cdb4cc) change mergeMaps order instead of checking for existence - [`af7a936`](https://github.com/nektos/act/commit/af7a936c52cd274b744cb4db6c6d98379ec4c370) Merge branch 'master' into master ### 📊 Changes **2 files changed** (+52 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `pkg/runner/run_context.go` (+1 -1) 📝 `pkg/runner/run_context_test.go` (+51 -0) </details> ### 📄 Description Simple approach to allowing for #1098 Since https://github.com/nektos/act/blob/b3bd268e4585b32673635685d68bf86c5b2d0bfa/pkg/runner/run_context.go#L78 specifies that the `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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-01 21:52:38 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#1775
No description provided.