mirror of
https://github.com/nektos/act.git
synced 2026-04-25 17:05:50 +03:00
[PR #5988] fix: Missing job-index and job-total attributes in strategy context #2649
Labels
No labels
area/action
area/cli
area/docs
area/image
area/runner
area/workflow
backlog
confirmed/not-planned
kind/bug
kind/discussion
kind/external
kind/feature-request
kind/question
meta/duplicate
meta/invalid
meta/need-more-info
meta/resolved
meta/wontfix
meta/workaround
needs-work
pull-request
review/not-planned
size/M
size/XL
size/XXL
stale
stale-exempt
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/act#2649
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/nektos/act/pull/5988
Author: @majiayu000
Created: 12/30/2025
Status: 🔄 Open
Base:
master← Head:fix-5976-missing-job-index-and-job-tota-1230-1417📝 Commits (5)
59ff473Add job-index and job-total to strategy context323a155Add tests for strategy.job-index and strategy.job-total724568fPass Matrix, MatrixIndex and MatrixCount to composite action RunContext45cd029test: cover strategy job index in workflows433d160Merge branch 'master' into fix-5976-missing-job-index-and-job-tota-1230-1417📊 Changes
9 files changed (+178 additions, -3 deletions)
View changed files
📝
pkg/runner/action_composite.go(+3 -0)📝
pkg/runner/expression.go(+10 -0)📝
pkg/runner/expression_test.go(+97 -0)📝
pkg/runner/run_context.go(+2 -0)📝
pkg/runner/runner.go(+5 -3)📝
pkg/runner/runner_test.go(+2 -0)➕
pkg/runner/testdata/strategy-job-index-composite/composite_action/action.yml(+28 -0)➕
pkg/runner/testdata/strategy-job-index-composite/push.yml(+14 -0)➕
pkg/runner/testdata/strategy-job-index/push.yml(+17 -0)📄 Description
Summary
This PR fixes #5976
Changes
MatrixIndexandMatrixCountfields toRunContextstruct to track the current matrix job index (0-based) and total number of matrix jobsnewRunContextfunction signature to accept and initialize these new fieldsjob-indexandjob-totalattributes to the strategy context in bothNewExpressionEvaluatorWithEnvandnewStepExpressionEvaluatorfunctionsstrategy.job-indexandstrategy.job-totalexpressions in workflows, matching GitHub Actions behaviorThe implementation follows GitHub Actions specification where:
job-index: 0-based index of the current job in the matrix (e.g., 0, 1, 2, 3 for 4 jobs)job-total: Total number of jobs in the matrixGenerated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.