Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
bennycode opened this issue Apr 9, 2022 · 0 comments · Fixed by #1137
Closed
Labels
kind/bug Something isn't working

Comments

@bennycode
Copy link

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 bennycode/demo-repo@e000f42):

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant