[PR #225] [MERGED] Make envs available in if conditionals #1390

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

📋 Pull Request Information

Original PR: https://github.com/nektos/act/pull/225
Author: @torbjornvatn
Created: 5/4/2020
Status: Merged
Merged: 5/4/2020
Merged by: @cplee

Base: masterHead: env_if


📝 Commits (7)

  • edbc976 Ignore .idea
  • cefbb91 Add Env to the RunContext vm so we can Evaluate and Interpolate env.xx
  • 1c56f2a Make EvalBool support expressions more in line with the github runner
  • f693413 Merge origin/master into env_if
  • bcee8b9 Turns out Boolean(value) is what github is doing after all
  • 63ea68a Add test for github context as well
  • 7840dc1 Merge upstream/master into env_if

📊 Changes

5 files changed (+155 additions, -18 deletions)

View changed files

📝 .gitignore (+1 -0)
📝 pkg/runner/expression.go (+12 -3)
📝 pkg/runner/expression_test.go (+26 -6)
📝 pkg/runner/run_context.go (+9 -9)
pkg/runner/run_context_test.go (+107 -0)

📄 Description

This PR adds the possibility to use envs in if conditionals like this:

- name: Some step
  if: env.SOMETHING   
  run: echo "GREAT!"

or like this:

- name: Some step
  if: ${{ env.RUNNING_LOCALLY != 'true' }}
  run: echo "GREAT!"

This is supported when the action runs on github, and I need it to avoid some slack messaging and deployment status updates when I test my actions locally with act.

fixes #224


🔄 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/225 **Author:** [@torbjornvatn](https://github.com/torbjornvatn) **Created:** 5/4/2020 **Status:** ✅ Merged **Merged:** 5/4/2020 **Merged by:** [@cplee](https://github.com/cplee) **Base:** `master` ← **Head:** `env_if` --- ### 📝 Commits (7) - [`edbc976`](https://github.com/nektos/act/commit/edbc9763257371329e62ee114971442247daaf60) Ignore .idea - [`cefbb91`](https://github.com/nektos/act/commit/cefbb91b64b3de88716b9efb632d084b862c5bf6) Add Env to the RunContext vm so we can Evaluate and Interpolate `env.xx` - [`1c56f2a`](https://github.com/nektos/act/commit/1c56f2a3b65daa1041c7c5f3b8bb0d8e0169d5fe) Make EvalBool support expressions more in line with the github runner - [`f693413`](https://github.com/nektos/act/commit/f693413d6ce2945d593924e0ee5374bf66ec6c94) Merge origin/master into env_if - [`bcee8b9`](https://github.com/nektos/act/commit/bcee8b91ed01ae0975c83974dae8c982a2465877) Turns out Boolean(value) is what github is doing after all - [`63ea68a`](https://github.com/nektos/act/commit/63ea68ad47a05c09705c142f1c576af9acab76a8) Add test for github context as well - [`7840dc1`](https://github.com/nektos/act/commit/7840dc1f40653ae2da4470a44c743a0efe861689) Merge upstream/master into env_if ### 📊 Changes **5 files changed** (+155 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `.gitignore` (+1 -0) 📝 `pkg/runner/expression.go` (+12 -3) 📝 `pkg/runner/expression_test.go` (+26 -6) 📝 `pkg/runner/run_context.go` (+9 -9) ➕ `pkg/runner/run_context_test.go` (+107 -0) </details> ### 📄 Description This PR adds the possibility to use envs in if conditionals like this: ```yaml - name: Some step if: env.SOMETHING run: echo "GREAT!" ``` or like this: ```yaml - name: Some step if: ${{ env.RUNNING_LOCALLY != 'true' }} run: echo "GREAT!" ``` This is supported when the action runs on github, and I need it to avoid some slack messaging and deployment status updates when I test my actions locally with act. fixes #224 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-01 21:50:58 +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#1390
No description provided.