[PR #5990] refactor: extract buildNeedsAndStrategy helper function #2648

Open
opened 2026-03-01 22:37:35 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/nektos/act/pull/5990
Author: @Mohamed-Elwasila
Created: 1/6/2026
Status: 🔄 Open

Base: masterHead: refactor/expression-evaluator-cleanup


📝 Commits (1)

  • bd89a70 refactor: extract buildNeedsAndStrategy helper function

📊 Changes

1 file changed (+20 additions, -27 deletions)

View changed files

📝 pkg/runner/expression.go (+20 -27)

📄 Description

Summary

  • Extracted duplicate logic for building needs and strategy maps into buildNeedsAndStrategy() helper function
  • Refactored NewExpressionEvaluatorWithEnv() and newStepExpressionEvaluator() to use the new helper
  • Removed completed TODO comments about cleanup

Motivation

There was duplicate code (~20 lines) in two functions that built the same needs and strategy maps for expression evaluation. This refactoring improves maintainability and reduces the chance of inconsistencies.

Test Plan

  • Code builds successfully (go build ./...)
  • No linting errors (golangci-lint run)
  • Code formatted with go fmt

Fixes TODO items in pkg/runner/expression.go:37 and pkg/runner/expression.go:124


🔄 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/5990 **Author:** [@Mohamed-Elwasila](https://github.com/Mohamed-Elwasila) **Created:** 1/6/2026 **Status:** 🔄 Open **Base:** `master` ← **Head:** `refactor/expression-evaluator-cleanup` --- ### 📝 Commits (1) - [`bd89a70`](https://github.com/nektos/act/commit/bd89a704830f8387ecee21b2d817dc6bded825fa) refactor: extract buildNeedsAndStrategy helper function ### 📊 Changes **1 file changed** (+20 additions, -27 deletions) <details> <summary>View changed files</summary> 📝 `pkg/runner/expression.go` (+20 -27) </details> ### 📄 Description ## Summary - Extracted duplicate logic for building needs and strategy maps into `buildNeedsAndStrategy()` helper function - Refactored `NewExpressionEvaluatorWithEnv()` and `newStepExpressionEvaluator()` to use the new helper - Removed completed TODO comments about cleanup ## Motivation There was duplicate code (~20 lines) in two functions that built the same needs and strategy maps for expression evaluation. This refactoring improves maintainability and reduces the chance of inconsistencies. ## Test Plan - Code builds successfully (`go build ./...`) - No linting errors (`golangci-lint run`) - Code formatted with `go fmt` Fixes TODO items in pkg/runner/expression.go:37 and pkg/runner/expression.go:124 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#2648
No description provided.