[PR #426] [MERGED] GitHub env file support #1447

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

📋 Pull Request Information

Original PR: https://github.com/nektos/act/pull/426
Author: @torbjornvatn
Created: 11/20/2020
Status: Merged
Merged: 1/12/2021
Merged by: @cplee

Base: masterHead: GITHUB_ENV


📝 Commits (10+)

  • 73f8b6b Upgrade to the official golangci-lint action and fix some issues it found
  • 0432a73 Update deps
  • d003fbf Remove a shadow warning
  • 918842a Initialize the splitPattern only once
  • 60b57d6 Initial attempt at supporting $GITHUB_ENV
  • 7ef8f8b Now it's actually working
  • d45ab89 Replace golang.org/x/crypto/ssh/terminal with golang.org/x/term
  • 31f2f0c Disable the issue-228 test again
  • e91bb03 The linter is picky
  • 3fa01a9 Merge upstream/master into GITHUB_ENV

📊 Changes

16 files changed (+492 additions, -107 deletions)

View changed files

📝 .github/workflows/push.yml (+4 -4)
📝 .github/workflows/test-expressions.yml (+1 -0)
📝 .golangci.yml (+4 -1)
📝 cmd/root.go (+11 -6)
📝 go.mod (+24 -27)
📝 go.sum (+339 -28)
📝 pkg/common/draw.go (+0 -1)
📝 pkg/common/git.go (+0 -1)
📝 pkg/container/docker_run.go (+62 -7)
📝 pkg/model/workflow.go (+3 -3)
📝 pkg/runner/command.go (+3 -3)
📝 pkg/runner/command_test.go (+19 -19)
📝 pkg/runner/expression_test.go (+0 -1)
📝 pkg/runner/logger.go (+3 -3)
📝 pkg/runner/run_context.go (+18 -2)
📝 pkg/runner/runner_test.go (+1 -1)

📄 Description

This PR attempts to add support for the new Environment Files since the ::set-env command has been deprecated.

I found a way to download a tar of the envs.txt file that I've assigned to $GITHUB_ENV from a previous step's container and merge the contents into the env map that is passed to the next step.
It's possible that there are more elegant ways of doing this, but I couldn't find any other way of getting access to that file between steps.

UPDATE: I did an new attempt at solving this using the existing command handler, but it didn't work as the new way of setting the envs uses the >> to file syntax. That output can be generated from any command that's called within the run: and as far as I understand that can't be intercepted in the command handler.

DEPRECATION? We should probably add a warning or an error if you try to use the old and deprecated ::set-env syntax, but I'm not sure how to best handle that @cplee

Fixes #384


🔄 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/426 **Author:** [@torbjornvatn](https://github.com/torbjornvatn) **Created:** 11/20/2020 **Status:** ✅ Merged **Merged:** 1/12/2021 **Merged by:** [@cplee](https://github.com/cplee) **Base:** `master` ← **Head:** `GITHUB_ENV` --- ### 📝 Commits (10+) - [`73f8b6b`](https://github.com/nektos/act/commit/73f8b6b0944ce607e1af23b35b9d3047b449da20) Upgrade to the official golangci-lint action and fix some issues it found - [`0432a73`](https://github.com/nektos/act/commit/0432a733e8bec5bc93a4fcf1c8def3d663eafe9c) Update deps - [`d003fbf`](https://github.com/nektos/act/commit/d003fbfe2a6e430c961b5800c8727843df1a9fd8) Remove a shadow warning - [`918842a`](https://github.com/nektos/act/commit/918842a47e86aa518526cb06e5d853a9333906e9) Initialize the splitPattern only once - [`60b57d6`](https://github.com/nektos/act/commit/60b57d697931aec0acc8ba0a9a40371ba75ab199) Initial attempt at supporting $GITHUB_ENV - [`7ef8f8b`](https://github.com/nektos/act/commit/7ef8f8bb3d2f2036d22ed425019818f14888bacc) Now it's actually working - [`d45ab89`](https://github.com/nektos/act/commit/d45ab89fcbfe104248a30767ebaf088f2f0cd215) Replace golang.org/x/crypto/ssh/terminal with golang.org/x/term - [`31f2f0c`](https://github.com/nektos/act/commit/31f2f0c71c9be53b2d72aa84d03a2e02d3dd225a) Disable the issue-228 test again - [`e91bb03`](https://github.com/nektos/act/commit/e91bb03d35062098ab25fe3921890629a566e226) The linter is picky - [`3fa01a9`](https://github.com/nektos/act/commit/3fa01a95c21e00d59ea7606ebd264c42d509a862) Merge upstream/master into GITHUB_ENV ### 📊 Changes **16 files changed** (+492 additions, -107 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/push.yml` (+4 -4) 📝 `.github/workflows/test-expressions.yml` (+1 -0) 📝 `.golangci.yml` (+4 -1) 📝 `cmd/root.go` (+11 -6) 📝 `go.mod` (+24 -27) 📝 `go.sum` (+339 -28) 📝 `pkg/common/draw.go` (+0 -1) 📝 `pkg/common/git.go` (+0 -1) 📝 `pkg/container/docker_run.go` (+62 -7) 📝 `pkg/model/workflow.go` (+3 -3) 📝 `pkg/runner/command.go` (+3 -3) 📝 `pkg/runner/command_test.go` (+19 -19) 📝 `pkg/runner/expression_test.go` (+0 -1) 📝 `pkg/runner/logger.go` (+3 -3) 📝 `pkg/runner/run_context.go` (+18 -2) 📝 `pkg/runner/runner_test.go` (+1 -1) </details> ### 📄 Description This PR attempts to add support for the new [Environment Files](https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#environment-files) since the `::set-env` command has been deprecated. I found a way to download a tar of the `envs.txt` file that I've assigned to `$GITHUB_ENV` from a previous step's container and merge the contents into the env map that is passed to the next step. It's possible that there are more elegant ways of doing this, but I couldn't find any other way of getting access to that file between steps. UPDATE: I did an new attempt at solving this using the existing command handler, but it didn't work as the new way of setting the envs uses the >> to file syntax. That output can be generated from any command that's called within the `run:` and as far as I understand that can't be intercepted in the command handler. DEPRECATION? We should probably add a warning or an error if you try to use the old and deprecated `::set-env` syntax, but I'm not sure how to best handle that @cplee Fixes #384 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-01 21:51:12 +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#1447
No description provided.