[PR #964] [MERGED] fix: deep evaluate matrix strategy #1706

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

📋 Pull Request Information

Original PR: https://github.com/nektos/act/pull/964
Author: @ChristopherHX
Created: 1/23/2022
Status: Merged
Merged: 2/15/2022
Merged by: @mergify[bot]

Base: masterHead: fix/evaluate_matrix


📝 Commits (7)

  • 92414ac fix: deep evaluate matrix strategy
  • f538b28 Try to make linter happy.
  • 40f2758 Apply PR feedback, fix insert directive more tests
  • 9c51a5d Fix: logic error
  • ba85761 Merge branch 'master' into fix/evaluate_matrix
  • 454db0b Merge branch 'master' into fix/evaluate_matrix
  • 0cce8cb Merge branch 'master' into fix/evaluate_matrix

📊 Changes

8 files changed (+238 additions, -46 deletions)

View changed files

📝 pkg/runner/expression.go (+78 -0)
📝 pkg/runner/runner.go (+58 -46)
📝 pkg/runner/runner_test.go (+5 -0)
pkg/runner/testdata/evalmatrix-merge-array/push.yml (+12 -0)
pkg/runner/testdata/evalmatrix-merge-map/push.yml (+14 -0)
pkg/runner/testdata/evalmatrix/push.yml (+18 -0)
pkg/runner/testdata/evalmatrixneeds/push.yml (+24 -0)
pkg/runner/testdata/evalmatrixneeds2/push.yml (+29 -0)

📄 Description

We need to wait for the previous stage to finish, otherwise we don't know how the final strategy will look like.
Then we need to evaluate all expression nodes of the strategy.matrix property, even the mapping keys.

I also added support for the insert directive and array merge operations, both are undocumented features of the github/actions which are available since 2019.

My tests aren't cover all possibilities, but the fixed issue has a test.

Most likely this change collides with @catthehacker plans of rewriting the yaml parser to actionslint, since I use the current yaml.Node types.

I have no idea how big the regressions regarding parallelism are with this change.

Resolves https://github.com/nektos/act/issues/927


🔄 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/964 **Author:** [@ChristopherHX](https://github.com/ChristopherHX) **Created:** 1/23/2022 **Status:** ✅ Merged **Merged:** 2/15/2022 **Merged by:** [@mergify[bot]](https://github.com/apps/mergify) **Base:** `master` ← **Head:** `fix/evaluate_matrix` --- ### 📝 Commits (7) - [`92414ac`](https://github.com/nektos/act/commit/92414acb400c2416f9d9bceacdb0b0b845ebf6d6) fix: deep evaluate matrix strategy - [`f538b28`](https://github.com/nektos/act/commit/f538b28a53f03e082feca382f18b1cdea0192d0c) Try to make linter happy. - [`40f2758`](https://github.com/nektos/act/commit/40f275893853e8c9e70ac2589c74b7daa08cce2a) Apply PR feedback, fix insert directive more tests - [`9c51a5d`](https://github.com/nektos/act/commit/9c51a5dffe6434bae43d39a4ffb5296d09c93bdc) Fix: logic error - [`ba85761`](https://github.com/nektos/act/commit/ba85761d4091fe22d64668c6b18f97516650e817) Merge branch 'master' into fix/evaluate_matrix - [`454db0b`](https://github.com/nektos/act/commit/454db0b6cc4d7e29f1c4dd6e02e8969e44702614) Merge branch 'master' into fix/evaluate_matrix - [`0cce8cb`](https://github.com/nektos/act/commit/0cce8cb7352022131ab15934f095b7cf23db14f3) Merge branch 'master' into fix/evaluate_matrix ### 📊 Changes **8 files changed** (+238 additions, -46 deletions) <details> <summary>View changed files</summary> 📝 `pkg/runner/expression.go` (+78 -0) 📝 `pkg/runner/runner.go` (+58 -46) 📝 `pkg/runner/runner_test.go` (+5 -0) ➕ `pkg/runner/testdata/evalmatrix-merge-array/push.yml` (+12 -0) ➕ `pkg/runner/testdata/evalmatrix-merge-map/push.yml` (+14 -0) ➕ `pkg/runner/testdata/evalmatrix/push.yml` (+18 -0) ➕ `pkg/runner/testdata/evalmatrixneeds/push.yml` (+24 -0) ➕ `pkg/runner/testdata/evalmatrixneeds2/push.yml` (+29 -0) </details> ### 📄 Description We need to wait for the previous stage to finish, otherwise we don't know how the final strategy will look like. Then we need to evaluate all expression nodes of the strategy.matrix property, even the mapping keys. I also added support for the insert directive and array merge operations, both are undocumented features of the github/actions which are available since 2019. My tests aren't cover all possibilities, but the fixed issue has a test. Most likely this change collides with @catthehacker plans of rewriting the yaml parser to actionslint, since I use the current yaml.Node types. I have no idea how big the regressions regarding parallelism are with this change. Resolves https://github.com/nektos/act/issues/927 --- <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:19 +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#1706
No description provided.