act icon indicating copy to clipboard operation
act copied to clipboard

${{ strategy.job-index }} is always empty

Open iKoznov opened this issue 2 years ago • 2 comments

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.

Link to GitHub repository

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

iKoznov avatar Aug 18 '23 22:08 iKoznov

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

xavierchanth avatar Aug 29 '23 04:08 xavierchanth

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

github-actions[bot] avatar Feb 26 '24 00:02 github-actions[bot]