[PR #908] [MERGED] Refactor expression evaluator to use parser from actionlint package #1678

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

📋 Pull Request Information

Original PR: https://github.com/nektos/act/pull/908
Author: @ZauberNerd
Created: 11/29/2021
Status: Merged
Merged: 1/21/2022
Merged by: @cplee

Base: masterHead: exprparser


📝 Commits (5)

  • f015e81 feat: implement expression evaluator
  • 78d834b feat: integrate exprparser into act
  • 8f9b9c8 Escape { and }, do not fail on missing properties
  • 6013c54 Fix empty inputs context
  • 73cf7e3 fix: contains() comparison for complex values

📊 Changes

12 files changed (+2028 additions, -689 deletions)

View changed files

📝 go.mod (+1 -4)
📝 go.sum (+18 -7)
pkg/exprparser/functions.go (+277 -0)
pkg/exprparser/functions_test.go (+245 -0)
pkg/exprparser/interpreter.go (+576 -0)
pkg/exprparser/interpreter_test.go (+581 -0)
pkg/exprparser/testdata/for-hashing-1.txt (+1 -0)
pkg/exprparser/testdata/for-hashing-2.txt (+1 -0)
📝 pkg/runner/expression.go (+186 -570)
📝 pkg/runner/expression_test.go (+124 -69)
📝 pkg/runner/run_context.go (+2 -27)
📝 pkg/runner/run_context_test.go (+16 -12)

📄 Description

This is an early draft to showcase the general direction we're going with this change.

We will of course rebase the commits, so that we can create separate PRs for the preparation-changes (refactoring of contexts, etc).

Also there's still a few TODO comments that we have to resolve before this PR is ready to merge.

Anyways, feedback is welcome :)

Next steps:

  • manually track position in evaluator (actionlint parser gives us only the starting position of a token, but we need to know how far we've parsed)
  • extend toString to be able to print all types
  • get act tests to pass with the exprparser package
  • clean-up errors, todos, tests, etc

🔄 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/908 **Author:** [@ZauberNerd](https://github.com/ZauberNerd) **Created:** 11/29/2021 **Status:** ✅ Merged **Merged:** 1/21/2022 **Merged by:** [@cplee](https://github.com/cplee) **Base:** `master` ← **Head:** `exprparser` --- ### 📝 Commits (5) - [`f015e81`](https://github.com/nektos/act/commit/f015e812b628ac49009a9f5625510e2a8580948e) feat: implement expression evaluator - [`78d834b`](https://github.com/nektos/act/commit/78d834bb23646b1bd30849eedcfeaefc1ce4663a) feat: integrate exprparser into act - [`8f9b9c8`](https://github.com/nektos/act/commit/8f9b9c8207f23b179d8dc37746f6e00645f84c27) Escape { and }, do not fail on missing properties - [`6013c54`](https://github.com/nektos/act/commit/6013c54e3430ca799587b873a2c9eb8c15b9a9f8) Fix empty inputs context - [`73cf7e3`](https://github.com/nektos/act/commit/73cf7e35b4765b1133f95dfcb303428997237ab2) fix: contains() comparison for complex values ### 📊 Changes **12 files changed** (+2028 additions, -689 deletions) <details> <summary>View changed files</summary> 📝 `go.mod` (+1 -4) 📝 `go.sum` (+18 -7) ➕ `pkg/exprparser/functions.go` (+277 -0) ➕ `pkg/exprparser/functions_test.go` (+245 -0) ➕ `pkg/exprparser/interpreter.go` (+576 -0) ➕ `pkg/exprparser/interpreter_test.go` (+581 -0) ➕ `pkg/exprparser/testdata/for-hashing-1.txt` (+1 -0) ➕ `pkg/exprparser/testdata/for-hashing-2.txt` (+1 -0) 📝 `pkg/runner/expression.go` (+186 -570) 📝 `pkg/runner/expression_test.go` (+124 -69) 📝 `pkg/runner/run_context.go` (+2 -27) 📝 `pkg/runner/run_context_test.go` (+16 -12) </details> ### 📄 Description ~~This is an early draft to showcase the general direction we're going with this change.~~ ~~We will of course rebase the commits, so that we can create separate PRs for the preparation-changes (refactoring of contexts, etc).~~ ~~Also there's still a few TODO comments that we have to resolve before this PR is ready to merge.~~ ~~Anyways, feedback is welcome :)~~ Next steps: - [x] manually track position in evaluator (actionlint parser gives us only the starting position of a token, but we need to know how far we've parsed) - [x] extend `toString` to be able to print all types - [x] get `act` tests to pass with the `exprparser` package - [x] clean-up errors, todos, tests, etc --- <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: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#1678
No description provided.