[GH-ISSUE #2648] Matrix include error #1202

Open
opened 2026-03-01 21:49:39 +03:00 by kerem · 4 comments
Owner

Originally created by @silky1313 on GitHub (Feb 7, 2025).
Original GitHub issue: https://github.com/nektos/act/issues/2648

Bug report info

act version:            0.2.71
GOOS:                   linux
GOARCH:                 amd64
NumCPU:                 8
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
        /var/run/docker.sock
Config files:           
        /home/silky/.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.23.5
        Module path:           github.com/nektos/act
        Main version:          (devel)
        Main path:             github.com/nektos/act
        Main checksum:         
        Build settings:
                -buildmode:           exe
                -compiler:            gc
                CGO_ENABLED:          0
                GOARCH:               amd64
                GOOS:                 linux
                GOAMD64:              v1
                vcs:                  git
                vcs.revision:         a9e31cde304fb989e59068c6b1cb2f04a5fa5931
                vcs.time:             2025-01-13T02:27:17Z
                vcs.modified:         true
Docker Engine:
        Engine version:        27.4.1
        Engine runtime:        runc
        Cgroup version:        2
        Cgroup driver:         systemd
        Storage driver:        overlay2
        Registry URI:          https://index.docker.io/v1/
        OS:                    Ubuntu 22.04.5 LTS
        OS type:               linux
        OS version:            22.04
        OS arch:               x86_64
        OS kernel:             6.8.0-52-generic
        OS CPU:                8
        OS memory:             15946 MB
        Security options:
                name=apparmor
                name=seccomp,profile=builtin
                name=cgroupns

Command used with act

act --action-offline-mode --verbose push

Describe issue

My own example

When I run the following workflow

name: test matrix
on:
  push:

jobs:
  echo-color:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        os: [macos-latest, windows-latest]
        version: [12, 14]
        include:
          - color: green
    steps:
      - name: echo color
        run: |
          echo 'os is ${{ matrix.os }}, version is ${{ matrix.version }}, color is ${{matrix.color}}'

The following is a relevant log of act

DEBU[0000] Final matrix after applying user inclusions '[map[os:macos-latest version:12] map[os:macos-latest version:14] map[os:windows-latest version:12] map[os:windows-latest version:14] map[color:green]]' 

But when I put this on github and run,results are as follows
https://github.com/silky1313/matrix/actions/runs/13193098626
When I run it on github, there are only four jobs, but when I run it with act, there are five jobs
In summary, I think this is a bug。

Test bug

In act/pkg/model/workflow_test.go.#TestReadWorkflow_Strategy
The result of the following matrix is

  matrix:
    datacenter:
      - site-c
      - site-d
    exclude:
      - datacenter: site-d
        node-version: 14.x
        site: staging
    include:
      - php-version: 5.4
      - datacenter: site-a
        node-version: 10.x
        site: prod
      - datacenter: site-b
        node-version: 12.x
        site: dev
    node-version: [14.x, 16.x]
    site:
      - staging
assert.Equal(t, matrixes,
		[]map[string]interface{}{
			{"datacenter": "site-c", "node-version": "14.x", "site": "staging"},
			{"datacenter": "site-c", "node-version": "16.x", "site": "staging"},
			{"datacenter": "site-d", "node-version": "16.x", "site": "staging"},
			{"php-version": 5.4},
			{"datacenter": "site-a", "node-version": "10.x", "site": "prod"},
			{"datacenter": "site-b", "node-version": "12.x", "site": "dev"},
		},
	)

But the map should actually get is

[]map[string]interface{}{
			{"datacenter": "site-c", "node-version": "14.x", "site": "staging", "php-version": 5.4},
			{"datacenter": "site-c", "node-version": "16.x", "site": "staging", "php-version": 5.4},
			{"datacenter": "site-d", "node-version": "16.x", "site": "staging", "php-version": 5.4},
			{"datacenter": "site-a", "node-version": "10.x", "site": "prod"},
			{"datacenter": "site-b", "node-version": "12.x", "site": "dev"},
		},

https://github.com/silky1313/matrix

Workflow content

name: test matrix
on:
  push:

jobs:
  echo-color:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        os: [macos-latest, windows-latest]
        version: [12, 14]
        include:
          - color: green
#        exclude:
#          - os: macos-latest
#            version: 12
#          - os: windows-latest
#            version: 14
    steps:
      - name: echo color
        run: |
          echo 'os is ${{ matrix.os }}, version is ${{ matrix.version }}, color is ${{matrix.color}}'
# 发现一些bug
# 按理来说应该是
# macos-latest, 12, green
# windows-latest, 12, green
# macos-latest, 14, green
# windows-latest, 14, green

Relevant log output

DEBU[0000] Job Matrices: [map[os:macos-latest version:12] map[os:macos-latest version:14] map[os:windows-latest version:12] map[os:windows-latest version:14] map[color:green]] 
DEBU[0000] Runner Matrices: map[]                       
DEBU[0000] Final matrix after applying user inclusions '[map[os:macos-latest version:12] map[os:macos-latest version:14] map[os:windows-latest version:12] map[os:windows-latest version:14] map[color:green]]'

Additional information

No response

Originally created by @silky1313 on GitHub (Feb 7, 2025). Original GitHub issue: https://github.com/nektos/act/issues/2648 ### Bug report info ```plain text act version: 0.2.71 GOOS: linux GOARCH: amd64 NumCPU: 8 Docker host: DOCKER_HOST environment variable is not set Sockets found: /var/run/docker.sock Config files: /home/silky/.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.23.5 Module path: github.com/nektos/act Main version: (devel) Main path: github.com/nektos/act Main checksum: Build settings: -buildmode: exe -compiler: gc CGO_ENABLED: 0 GOARCH: amd64 GOOS: linux GOAMD64: v1 vcs: git vcs.revision: a9e31cde304fb989e59068c6b1cb2f04a5fa5931 vcs.time: 2025-01-13T02:27:17Z vcs.modified: true Docker Engine: Engine version: 27.4.1 Engine runtime: runc Cgroup version: 2 Cgroup driver: systemd Storage driver: overlay2 Registry URI: https://index.docker.io/v1/ OS: Ubuntu 22.04.5 LTS OS type: linux OS version: 22.04 OS arch: x86_64 OS kernel: 6.8.0-52-generic OS CPU: 8 OS memory: 15946 MB Security options: name=apparmor name=seccomp,profile=builtin name=cgroupns ``` ### Command used with act ```sh act --action-offline-mode --verbose push ``` ### Describe issue #### My own example When I run the following workflow ```yaml name: test matrix on: push: jobs: echo-color: runs-on: ubuntu-latest strategy: matrix: os: [macos-latest, windows-latest] version: [12, 14] include: - color: green steps: - name: echo color run: | echo 'os is ${{ matrix.os }}, version is ${{ matrix.version }}, color is ${{matrix.color}}' ``` The following is a relevant log of act ``` DEBU[0000] Final matrix after applying user inclusions '[map[os:macos-latest version:12] map[os:macos-latest version:14] map[os:windows-latest version:12] map[os:windows-latest version:14] map[color:green]]' ``` But when I put this on github and run,results are as follows https://github.com/silky1313/matrix/actions/runs/13193098626 When I run it on github, there are only four jobs, but when I run it with act, there are five jobs In summary, I think this is a bug。 #### Test bug In `act/pkg/model/workflow_test.go.#TestReadWorkflow_Strategy` The result of the following matrix is ``` matrix: datacenter: - site-c - site-d exclude: - datacenter: site-d node-version: 14.x site: staging include: - php-version: 5.4 - datacenter: site-a node-version: 10.x site: prod - datacenter: site-b node-version: 12.x site: dev node-version: [14.x, 16.x] site: - staging ``` ```go assert.Equal(t, matrixes, []map[string]interface{}{ {"datacenter": "site-c", "node-version": "14.x", "site": "staging"}, {"datacenter": "site-c", "node-version": "16.x", "site": "staging"}, {"datacenter": "site-d", "node-version": "16.x", "site": "staging"}, {"php-version": 5.4}, {"datacenter": "site-a", "node-version": "10.x", "site": "prod"}, {"datacenter": "site-b", "node-version": "12.x", "site": "dev"}, }, ) ``` But the map should actually get is ```go []map[string]interface{}{ {"datacenter": "site-c", "node-version": "14.x", "site": "staging", "php-version": 5.4}, {"datacenter": "site-c", "node-version": "16.x", "site": "staging", "php-version": 5.4}, {"datacenter": "site-d", "node-version": "16.x", "site": "staging", "php-version": 5.4}, {"datacenter": "site-a", "node-version": "10.x", "site": "prod"}, {"datacenter": "site-b", "node-version": "12.x", "site": "dev"}, }, ``` ### Link to GitHub repository https://github.com/silky1313/matrix ### Workflow content ```yml name: test matrix on: push: jobs: echo-color: runs-on: ubuntu-latest strategy: matrix: os: [macos-latest, windows-latest] version: [12, 14] include: - color: green # exclude: # - os: macos-latest # version: 12 # - os: windows-latest # version: 14 steps: - name: echo color run: | echo 'os is ${{ matrix.os }}, version is ${{ matrix.version }}, color is ${{matrix.color}}' # 发现一些bug # 按理来说应该是 # macos-latest, 12, green # windows-latest, 12, green # macos-latest, 14, green # windows-latest, 14, green ``` ### Relevant log output ```sh DEBU[0000] Job Matrices: [map[os:macos-latest version:12] map[os:macos-latest version:14] map[os:windows-latest version:12] map[os:windows-latest version:14] map[color:green]] DEBU[0000] Runner Matrices: map[] DEBU[0000] Final matrix after applying user inclusions '[map[os:macos-latest version:12] map[os:macos-latest version:14] map[os:windows-latest version:12] map[os:windows-latest version:14] map[color:green]]' ``` ### Additional information _No response_
Author
Owner

@silky1313 commented on GitHub (Feb 7, 2025):

If it is a real problem, I can submit a Pull request to solve it.

<!-- gh-comment-id:2642053171 --> @silky1313 commented on GitHub (Feb 7, 2025): If it is a real problem, I can submit a Pull request to solve it.
Author
Owner

@silky1313 commented on GitHub (Feb 7, 2025):

<!-- gh-comment-id:2642085595 --> @silky1313 commented on GitHub (Feb 7, 2025): - https://github.com/silky1313/matrix/actions/runs/13194792191/job/36833994613 The above workflow confirms that the bug does exist
Author
Owner

@unvermuthet commented on GitHub (Feb 7, 2025):

I just ran into this too while trying to have the include entires augmented by the matrix. Glad to see that you already fixed this. Thanks!

<!-- gh-comment-id:2642855776 --> @unvermuthet commented on GitHub (Feb 7, 2025): I just ran into this too while trying to have the include entires augmented by the matrix. Glad to see that you already fixed this. Thanks!
Author
Owner

@julianxhokaxhiu commented on GitHub (Apr 17, 2025):

I just crossed this issue as well and would be nice to have a fix for it as it's creating an extra job for no reason. Thanks again!

<!-- gh-comment-id:2814111497 --> @julianxhokaxhiu commented on GitHub (Apr 17, 2025): I just crossed this issue as well and would be nice to have a fix for it as it's creating an extra job for no reason. Thanks again!
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#1202
No description provided.