[PR #424] [MERGED] EvalBool and Interpolation fixes #1446

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/424
Author: @torbjornvatn
Created: 11/16/2020
Status: Merged
Merged: 11/17/2020
Merged by: @cplee

Base: masterHead: eval_and_interpolation


📝 Commits (3)

  • 8195cd5 A new attempt at Interpolation and EvalBool
  • 7151d84 One small merge fix
  • 57e073e Remove some fmt.Printfs

📊 Changes

6 files changed (+762 additions, -117 deletions)

View changed files

.github/workflows/test-expressions.yml (+82 -0)
.github/workflows/test-if.yml (+391 -0)
📝 pkg/runner/expression.go (+24 -14)
📝 pkg/runner/expression_test.go (+74 -7)
📝 pkg/runner/run_context.go (+51 -44)
📝 pkg/runner/run_context_test.go (+140 -52)

📄 Description

I had take another stab at fixing the Interpolation and EvalBool functions so their results match the somewhat weird ones performed by live Github actions.

I've added some auto generated workflows that verifies that the assumptions we make about how Github evaluates stuff is actually true. So the EvalBool test in run_context_test.go no checks that act evaluates expression and booleans the same as Github does.
Screenshot 2020-11-16 at 23 36 46

I had to make some really weird exceptions to make it work though, to me it seems that the expression parser that the Github actions runner either has some bugs or the developers has made some strange design choices.
I've tried to explain the weirdness in the comments here: https://github.com/unacast/act/blob/eval_and_interpolation/pkg/runner/run_context.go#L289

The test-expressions.yml and test-if.yml workflow files are auto generated every time the expression and run_context tests are run, to make sure that future changes to the tests (because the code has changed) or to the Github actions runner are detected.

Some of the issues that this PR tries to solve are described in #353 and #366

Fixes #353
Fixes #366


🔄 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/424 **Author:** [@torbjornvatn](https://github.com/torbjornvatn) **Created:** 11/16/2020 **Status:** ✅ Merged **Merged:** 11/17/2020 **Merged by:** [@cplee](https://github.com/cplee) **Base:** `master` ← **Head:** `eval_and_interpolation` --- ### 📝 Commits (3) - [`8195cd5`](https://github.com/nektos/act/commit/8195cd517f9ed4aa95e9edf45ffcb0c41fbde84a) A new attempt at Interpolation and EvalBool - [`7151d84`](https://github.com/nektos/act/commit/7151d8408a5c3dc35b41185086b306286146c358) One small merge fix - [`57e073e`](https://github.com/nektos/act/commit/57e073e1d3ae7d3ee2d77b9a8f440d73ba3c591c) Remove some fmt.Printfs ### 📊 Changes **6 files changed** (+762 additions, -117 deletions) <details> <summary>View changed files</summary> ➕ `.github/workflows/test-expressions.yml` (+82 -0) ➕ `.github/workflows/test-if.yml` (+391 -0) 📝 `pkg/runner/expression.go` (+24 -14) 📝 `pkg/runner/expression_test.go` (+74 -7) 📝 `pkg/runner/run_context.go` (+51 -44) 📝 `pkg/runner/run_context_test.go` (+140 -52) </details> ### 📄 Description I had take another stab at fixing the Interpolation and EvalBool functions so their results match the somewhat weird ones performed by live Github actions. I've added some auto generated workflows that verifies that the assumptions we make about how Github evaluates stuff is actually true. So the EvalBool test in `run_context_test.go` no checks that act evaluates expression and booleans the same as Github does. <img width="343" alt="Screenshot 2020-11-16 at 23 36 46" src="https://user-images.githubusercontent.com/4453/99316395-9b2a1880-2864-11eb-8052-384fdd0c4546.png"> I had to make some really weird exceptions to make it work though, to me it seems that the expression parser that the Github actions runner either has some bugs or the developers has made some strange design choices. I've tried to explain the weirdness in the comments here: https://github.com/unacast/act/blob/eval_and_interpolation/pkg/runner/run_context.go#L289 The `test-expressions.yml` and `test-if.yml` workflow files are auto generated every time the expression and run_context tests are run, to make sure that future changes to the tests (because the code has changed) or to the Github actions runner are detected. Some of the issues that this PR tries to solve are described in #353 and #366 Fixes #353 Fixes #366 --- <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#1446
No description provided.