[GH-ISSUE #1975] ${{ strategy.job-index }} is always empty #945

Closed
opened 2026-03-01 21:47:37 +03:00 by kerem · 2 comments
Owner

Originally created by @iKoznov on GitHub (Aug 18, 2023).
Original GitHub issue: https://github.com/nektos/act/issues/1975

Bug report info

act version:            0.2.49
GOOS:                   darwin
GOARCH:                 amd64
NumCPU:                 16
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
        $HOME/.docker/run/docker.sock
Config files:           
        /Users/ik/.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.20.6
        Module path:           command-line-arguments
        Main version:          
        Main path:             
        Main checksum:         
        Build settings:
                -buildmode:           exe
                -compiler:            gc
                -ldflags:             -X main.version=0.2.49
                CGO_ENABLED:          1
                CGO_CFLAGS:           
                CGO_CPPFLAGS:         
                CGO_CXXFLAGS:         
                CGO_LDFLAGS:          
                GOARCH:               amd64
                GOOS:                 darwin
                GOAMD64:              v1

Command used with act

act -v

Describe issue

I'm trying to run workflow with jobs matrix and get job index with ${{ strategy.job-index }}, but it always empty. Matrix itself works fine.

https://github.com/iKoznov/github-act-job-index-bug

Workflow content

name: Test
on:
  workflow_dispatch:
  push:
    branches: ["main", "master"]
    tags: ["v*"]
  pull_request:
    branches: ["main", "master"]

permissions:
  contents: read

jobs:
  test:
    strategy:
      fail-fast: false
      matrix:
        name: [1, 2, 3, 4, 5, 6, 7]

    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      -
        shell: python3 {0}
        run: |
          print("job-index:", ${{ strategy.job-index }})
          print("name:", ${{ matrix.name }})

Relevant log output

[Test/test-2]   | job-index:
[Test/test-2]   | name: 2

Additional information

No response

Originally created by @iKoznov on GitHub (Aug 18, 2023). Original GitHub issue: https://github.com/nektos/act/issues/1975 ### Bug report info ```plain text act version: 0.2.49 GOOS: darwin GOARCH: amd64 NumCPU: 16 Docker host: DOCKER_HOST environment variable is not set Sockets found: $HOME/.docker/run/docker.sock Config files: /Users/ik/.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.20.6 Module path: command-line-arguments Main version: Main path: Main checksum: Build settings: -buildmode: exe -compiler: gc -ldflags: -X main.version=0.2.49 CGO_ENABLED: 1 CGO_CFLAGS: CGO_CPPFLAGS: CGO_CXXFLAGS: CGO_LDFLAGS: GOARCH: amd64 GOOS: darwin GOAMD64: v1 ``` ### Command used with act ```sh act -v ``` ### Describe issue I'm trying to run workflow with jobs matrix and get job index with `${{ strategy.job-index }}`, but it always empty. Matrix itself works fine. ### Link to GitHub repository https://github.com/iKoznov/github-act-job-index-bug ### Workflow content ```yml name: Test on: workflow_dispatch: push: branches: ["main", "master"] tags: ["v*"] pull_request: branches: ["main", "master"] permissions: contents: read jobs: test: strategy: fail-fast: false matrix: name: [1, 2, 3, 4, 5, 6, 7] runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - shell: python3 {0} run: | print("job-index:", ${{ strategy.job-index }}) print("name:", ${{ matrix.name }}) ``` ### Relevant log output ```sh [Test/test-2] | job-index: [Test/test-2] | name: 2 ``` ### Additional information _No response_
kerem 2026-03-01 21:47:37 +03:00
Author
Owner

@xavierchanth commented on GitHub (Aug 29, 2023):

+1, my matrix config is too complex to manually index, and yet I require the job index in later steps

<!-- gh-comment-id:1696762801 --> @xavierchanth commented on GitHub (Aug 29, 2023): +1, my matrix config is too complex to manually index, and yet I require the job index in later steps
Author
Owner

@github-actions[bot] commented on GitHub (Feb 26, 2024):

Issue is stale and will be closed in 14 days unless there is new activity

<!-- gh-comment-id:1963114396 --> @github-actions[bot] commented on GitHub (Feb 26, 2024): Issue is stale and will be closed in 14 days unless there is new activity
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#945
No description provided.