Skip to content

Missing job-index and job-total attributes in strategy context #5976

Description

@lionelnicolas

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
}

Link to GitHub repository

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions