[GH-ISSUE #1115] Issue: act cannot evaluate if-condition (Unable to index on non-slice value: invalid) #634

Closed
opened 2026-03-01 21:45:07 +03:00 by kerem · 0 comments
Owner

Originally created by @bennycode on GitHub (Apr 9, 2022).
Original GitHub issue: https://github.com/nektos/act/issues/1115

System information

  • Operating System: Windows 10 Pro
  • Architecture: x64 (64-bit)
  • Apple M1: no
  • Docker version: 20.10.13
  • Docker image used in act: Micro
  • act version: act version 0.2.26

Expected behaviour

Test job should be started and if-condition should be parsed.

Actual behaviour

I tried to run my "test" job with act -j test but unfortunately "act" does not understand this "if" condition (which is valid GitHub Actions syntax, see github.com/bennycode/demo-repo@e000f425ac):

jobs:
  test:
    runs-on: ${{ matrix.os }}
    if: |
      contains(github.event.commits[0].message, '[skip ci]') == false &&
      contains(github.event.commits[0].message, '[ci skip]') == false   

Output:

Error in if-expression: "if: contains(github.event.commits[0].message, '[skip ci]') == false &&
contains(github.event.commits[0].message, '[ci skip]') == false
" (Unable to index on non-slice value: invalid)

Workflow and/or repository

Repository: https://github.com/bennycode/demo-repo

workflow
name: 'Test'

on:
  pull_request:
  push:
    branches: [ 'main' ]
  workflow_dispatch:

jobs:
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ 'ubuntu-latest' ]
        node-version: [ '16.x' ]
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - name: 'Checkout repository'
        uses: actions/checkout@v3

      # Uses specific version of Node.js
      - name: 'Use Node.js v${{ matrix.node-version }}'
        uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node-version }}

      # Runs commands using the runners shell
      - name: 'Run tests'
        run: |
          npm install
          npx tsc --noEmit
          npm test

Steps to reproduce

  1. Clone https://github.com/bennycode/demo-repo
  2. Run act -j test

act output

Log
act.exe -j test
Error:   ❌  Error in if-expression: "if: contains(github.event.commits[0].message, '[skip ci]') == false &&
contains(github.event.commits[0].message, '[ci skip]') == false
" (Unable to index on non-slice value: invalid)
Originally created by @bennycode on GitHub (Apr 9, 2022). Original GitHub issue: https://github.com/nektos/act/issues/1115 ## System information - Operating System: Windows 10 Pro - Architecture: x64 (64-bit) - Apple M1: no - Docker version: 20.10.13 - Docker image used in `act`: Micro - `act` version: act version 0.2.26 ## Expected behaviour Test job should be started and if-condition should be parsed. ## Actual behaviour I tried to run my "test" job with `act -j test` but unfortunately "act" does not understand this "if" condition (which is valid GitHub Actions syntax, see https://github.com/bennycode/demo-repo/commit/e000f425ac12328cb43c1bdf5805944d9a04407a): ```yml jobs: test: runs-on: ${{ matrix.os }} if: | contains(github.event.commits[0].message, '[skip ci]') == false && contains(github.event.commits[0].message, '[ci skip]') == false ``` **Output:** > Error in if-expression: "if: contains(github.event.commits[0].message, '[skip ci]') == false && contains(github.event.commits[0].message, '[ci skip]') == false " (Unable to index on non-slice value: invalid) ## Workflow and/or repository Repository: https://github.com/bennycode/demo-repo <details> <summary>workflow</summary> ```none name: 'Test' on: pull_request: push: branches: [ 'main' ] workflow_dispatch: jobs: test: runs-on: ${{ matrix.os }} strategy: matrix: os: [ 'ubuntu-latest' ] node-version: [ '16.x' ] steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - name: 'Checkout repository' uses: actions/checkout@v3 # Uses specific version of Node.js - name: 'Use Node.js v${{ matrix.node-version }}' uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} # Runs commands using the runners shell - name: 'Run tests' run: | npm install npx tsc --noEmit npm test ``` </details> ## Steps to reproduce 1. Clone https://github.com/bennycode/demo-repo 2. Run `act -j test` ## `act` output <!-- - Use `act` with `-v`/`--verbose` and paste output from your terminal in code block below --> <details> <summary>Log</summary> ```none act.exe -j test Error: ❌ Error in if-expression: "if: contains(github.event.commits[0].message, '[skip ci]') == false && contains(github.event.commits[0].message, '[ci skip]') == false " (Unable to index on non-slice value: invalid) ``` </details>
kerem 2026-03-01 21:45:07 +03:00
  • closed this issue
  • added the
    kind/bug
    label
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#634
No description provided.