[GH-ISSUE #5976] Missing job-index and job-total attributes in strategy context #1309

Open
opened 2026-03-01 21:50:17 +03:00 by kerem · 0 comments
Owner

Originally created by @lionelnicolas on GitHub (Dec 9, 2025).
Original GitHub issue: https://github.com/nektos/act/issues/5976

Bug report info

act version:            0.2.83
GOOS:                   linux
GOARCH:                 amd64
NumCPU:                 48
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
	/var/run/docker.sock
Config files:           
	/home/lionel/.config/act/actrc:
		-P ubuntu-latest=catthehacker/ubuntu:act-latest
		-P ubuntu-22.04=catthehacker/ubuntu:act-22.04
		-P ubuntu-20.04=catthehacker/ubuntu:act-20.04
		-P ubuntu-18.04=catthehacker/ubuntu:act-18.04
Build info:
	Go version:            go1.24.0
	Module path:           github.com/nektos/act
	Main version:          v0.2.83
	Main path:             github.com/nektos/act
	Main checksum:         
	Build settings:
		-buildmode:           exe
		-compiler:            gc
		-ldflags:             -s -w -X main.version=0.2.83 -X main.commit=6abb86789f54da787d1f8c32c1a295e0a9ecd0c3 -X main.date=2025-12-01T02:51:32Z -X main.builtBy=goreleaser
		CGO_ENABLED:          0
		GOARCH:               amd64
		GOOS:                 linux
		GOAMD64:              v1
		vcs:                  git
		vcs.revision:         6abb86789f54da787d1f8c32c1a295e0a9ecd0c3
		vcs.time:             2025-12-01T02:51:07Z
		vcs.modified:         false
Docker Engine:
	Engine version:        29.1.1
	Engine runtime:        runc
	Cgroup version:        2
	Cgroup driver:         systemd
	Storage driver:        overlay2
	Registry URI:          https://index.docker.io/v1/
	OS:                    Ubuntu 24.04.3 LTS
	OS type:               linux
	OS version:            24.04
	OS arch:               x86_64
	OS kernel:             6.14.0-36-generic
	OS CPU:                48
	OS memory:             257826 MB
	Security options:
		name=apparmor
		name=seccomp,profile=builtin
		name=cgroupns

Command used with act

act pull_request -P self-hosted=ubuntu --job debug-gh-action

Describe issue

The strategy context is missing job information, and doesn't comply with github actions contexts reference

act's strategy object is :

{
  fail-fast: true,
  max-parallel: 4
}

Instead of something like :

{
  "fail-fast": true,
  "job-index": 3,
  "job-total": 4,
  "max-parallel": 4
}

No response

Workflow content

name: Debug
on:
  workflow_dispatch:

defaults:
  run:
    shell: bash

concurrency:
  group: ${{ github.ref }}
  cancel-in-progress: true

jobs:
  debug-gh-action:
    name: Debug local
    runs-on: self-hosted
    env:
      TOTAL_SHARDS: "${{ strategy.job-total }}"
    steps:
      - name: Run test
        run: |
          SHARD_INDEX=${{ strategy.job-index }}

          printf -- "------------------------------------\n"
          echo TOTAL_SHARDS="${TOTAL_SHARDS}"
          echo SHARD_INDEX="${SHARD_INDEX}"
          printf -- "------------------------------------\n"
          echo "${{ toJSON(strategy) }}"
          printf -- "------------------------------------\n"

    # workaround to support gitlab's `parallel: 5` feature
    strategy:
      matrix:
        parallel-runs: [0, 1, 2, 3, 4]

Relevant log output

[Debug/Debug local-5] 🧪  Matrix: map[parallel-runs:4]
[Debug/Debug local-5] ⭐ Run Main Run example test
[Debug/Debug local-5]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/0.sh] user= workdir=
| ------------------------------------
| TOTAL_SHARDS=
| SHARD_INDEX=
| ------------------------------------
| {
|   fail-fast: true,
|   max-parallel: 4
| }
| ------------------------------------
[Debug/Debug local-5]   ✅  Success - Main Run example test [105.384576ms]
[Debug/Debug local-5] ⭐ Run Complete job
[Debug/Debug local-5] Cleaning up container for job Debug local
[Debug/Debug local-5]   ✅  Success - Complete job

Additional information

No response

Originally created by @lionelnicolas on GitHub (Dec 9, 2025). Original GitHub issue: https://github.com/nektos/act/issues/5976 ### Bug report info ```plain text act version: 0.2.83 GOOS: linux GOARCH: amd64 NumCPU: 48 Docker host: DOCKER_HOST environment variable is not set Sockets found: /var/run/docker.sock Config files: /home/lionel/.config/act/actrc: -P ubuntu-latest=catthehacker/ubuntu:act-latest -P ubuntu-22.04=catthehacker/ubuntu:act-22.04 -P ubuntu-20.04=catthehacker/ubuntu:act-20.04 -P ubuntu-18.04=catthehacker/ubuntu:act-18.04 Build info: Go version: go1.24.0 Module path: github.com/nektos/act Main version: v0.2.83 Main path: github.com/nektos/act Main checksum: Build settings: -buildmode: exe -compiler: gc -ldflags: -s -w -X main.version=0.2.83 -X main.commit=6abb86789f54da787d1f8c32c1a295e0a9ecd0c3 -X main.date=2025-12-01T02:51:32Z -X main.builtBy=goreleaser CGO_ENABLED: 0 GOARCH: amd64 GOOS: linux GOAMD64: v1 vcs: git vcs.revision: 6abb86789f54da787d1f8c32c1a295e0a9ecd0c3 vcs.time: 2025-12-01T02:51:07Z vcs.modified: false Docker Engine: Engine version: 29.1.1 Engine runtime: runc Cgroup version: 2 Cgroup driver: systemd Storage driver: overlay2 Registry URI: https://index.docker.io/v1/ OS: Ubuntu 24.04.3 LTS OS type: linux OS version: 24.04 OS arch: x86_64 OS kernel: 6.14.0-36-generic OS CPU: 48 OS memory: 257826 MB Security options: name=apparmor name=seccomp,profile=builtin name=cgroupns ``` ### Command used with act ```sh act pull_request -P self-hosted=ubuntu --job debug-gh-action ``` ### Describe issue The `strategy` context is missing job information, and doesn't comply with github actions [contexts reference](https://docs.github.com/en/actions/reference/workflows-and-actions/contexts#strategy-context) `act`'s `strategy` object is : ``` { fail-fast: true, max-parallel: 4 } ``` Instead of something like : ``` { "fail-fast": true, "job-index": 3, "job-total": 4, "max-parallel": 4 } ``` ### Link to GitHub repository _No response_ ### Workflow content ```yml name: Debug on: workflow_dispatch: defaults: run: shell: bash concurrency: group: ${{ github.ref }} cancel-in-progress: true jobs: debug-gh-action: name: Debug local runs-on: self-hosted env: TOTAL_SHARDS: "${{ strategy.job-total }}" steps: - name: Run test run: | SHARD_INDEX=${{ strategy.job-index }} printf -- "------------------------------------\n" echo TOTAL_SHARDS="${TOTAL_SHARDS}" echo SHARD_INDEX="${SHARD_INDEX}" printf -- "------------------------------------\n" echo "${{ toJSON(strategy) }}" printf -- "------------------------------------\n" # workaround to support gitlab's `parallel: 5` feature strategy: matrix: parallel-runs: [0, 1, 2, 3, 4] ``` ### Relevant log output ```sh [Debug/Debug local-5] 🧪 Matrix: map[parallel-runs:4] [Debug/Debug local-5] ⭐ Run Main Run example test [Debug/Debug local-5] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/0.sh] user= workdir= | ------------------------------------ | TOTAL_SHARDS= | SHARD_INDEX= | ------------------------------------ | { | fail-fast: true, | max-parallel: 4 | } | ------------------------------------ [Debug/Debug local-5] ✅ Success - Main Run example test [105.384576ms] [Debug/Debug local-5] ⭐ Run Complete job [Debug/Debug local-5] Cleaning up container for job Debug local [Debug/Debug local-5] ✅ Success - Complete job ``` ### Additional information _No response_
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#1309
No description provided.