[GH-ISSUE #504] Use of env causes index out of range error #345

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

Originally created by @dchambers on GitHub (Jan 27, 2021).
Original GitHub issue: https://github.com/nektos/act/issues/504

Info: act version 0.2.18 (installed using brew install act)

Given the following GitHub Yaml:

name: 'libs/mylib (on:push)'

on:
  push:
    paths:
      - '*'

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v1
        with:
          node-version: 12.x
      - env:
          MY_SECRET: special-secret
      - run: yarn

I see the following output when I run act -s ubuntu-latest=lucasalt/act_base:latest -n | grep mylib:

*DRYRUN* [libs/mylib (on:push)/build                     ] 🚀  Start image=lucasalt/act_base:latest
*DRYRUN* [libs/mylib (on:push)/build                     ]   🐳  docker run image=lucasalt/act_base:latest entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
*DRYRUN* [libs/mylib (on:push)/build                     ] ⭐  Run actions/checkout@v2
*DRYRUN* [libs/mylib (on:push)/build                     ]   ✅  Success - actions/checkout@v2
*DRYRUN* [libs/mylib (on:push)/build                     ] ⭐  Run actions/setup-node@v1
*DRYRUN* [libs/mylib (on:push)/build                     ]   ☁  git clone 'https://github.com/actions/setup-node' # ref=v1
*DRYRUN* [libs/mylib (on:push)/build                     ]   ✅  Success - actions/setup-node@v1
*DRYRUN* [libs/mylib (on:push)/build                     ] ⭐  Run 2
panic: runtime error: index out of range [1] with length 0

goroutine 24 [running]:
github.com/nektos/act/pkg/runner.newRemoteAction(0x0, 0x0, 0x0)
	/private/tmp/act-20210112-34242-iay2nt/act-0.2.18/pkg/runner/step_context.go:382 +0x1b9
github.com/nektos/act/pkg/runner.(*StepContext).Executor(0xc0003c2080, 0x19c4762)
	/private/tmp/act-20210112-34242-iay2nt/act-0.2.18/pkg/runner/step_context.go:59 +0x24c
github.com/nektos/act/pkg/runner.(*RunContext).newStepExecutor.func1(0x1add840, 0xc0003be0f0, 0x0, 0x0)
	/private/tmp/act-20210112-34242-iay2nt/act-0.2.18/pkg/runner/run_context.go:227 +0x3a5
github.com/nektos/act/pkg/common.Executor.Then.func1(0x1add840, 0xc0003be0f0, 0xc000390190, 0xc00030de18)
	/private/tmp/act-20210112-34242-iay2nt/act-0.2.18/pkg/common/executor.go:146 +0x184
github.com/nektos/act/pkg/common.Executor.Then.func1(0x1add840, 0xc0003be0f0, 0xc0003d4b40, 0xc000390100)
	/private/tmp/act-20210112-34242-iay2nt/act-0.2.18/pkg/common/executor.go:133 +0x4c
github.com/nektos/act/pkg/common.Executor.Then.func1(0x1add840, 0xc0003be0f0, 0x1, 0x1fb22e8)
	/private/tmp/act-20210112-34242-iay2nt/act-0.2.18/pkg/common/executor.go:133 +0x4c
github.com/nektos/act/pkg/common.Executor.If.func1(0x1add840, 0xc0003be0f0, 0xc00049a000, 0x2f)
	/private/tmp/act-20210112-34242-iay2nt/act-0.2.18/pkg/common/executor.go:154 +0x6a
github.com/nektos/act/pkg/runner.(*runnerImpl).NewPlanExecutor.func1(0x1add840, 0xc000399a40, 0xc00007e000, 0xc000383770)
	/private/tmp/act-20210112-34242-iay2nt/act-0.2.18/pkg/runner/runner.go:79 +0x242
github.com/nektos/act/pkg/common.Executor.ChannelError.func1(0x1add840, 0xc000399a40, 0xc00007e000, 0x0)
	/private/tmp/act-20210112-34242-iay2nt/act-0.2.18/pkg/common/executor.go:125 +0x45
github.com/nektos/act/pkg/common.NewParallelExecutor.func1.1(0xc00051be40, 0xc0002ce540, 0x1add840, 0xc000399a40)
	/private/tmp/act-20210112-34242-iay2nt/act-0.2.18/pkg/common/executor.go:101 +0x56
created by github.com/nektos/act/pkg/common.NewParallelExecutor.func1
	/private/tmp/act-20210112-34242-iay2nt/act-0.2.18/pkg/common/executor.go:100 +0xb7

All other tasks works fine. Only this one task that make use of env has a problem?

Originally created by @dchambers on GitHub (Jan 27, 2021). Original GitHub issue: https://github.com/nektos/act/issues/504 Info: `act version 0.2.18` (installed using `brew install act`) Given the following GitHub Yaml: ```yml name: 'libs/mylib (on:push)' on: push: paths: - '*' jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v1 with: node-version: 12.x - env: MY_SECRET: special-secret - run: yarn ``` I see the following output when I run `act -s ubuntu-latest=lucasalt/act_base:latest -n | grep mylib`: ```sh *DRYRUN* [libs/mylib (on:push)/build ] 🚀 Start image=lucasalt/act_base:latest *DRYRUN* [libs/mylib (on:push)/build ] 🐳 docker run image=lucasalt/act_base:latest entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[] *DRYRUN* [libs/mylib (on:push)/build ] ⭐ Run actions/checkout@v2 *DRYRUN* [libs/mylib (on:push)/build ] ✅ Success - actions/checkout@v2 *DRYRUN* [libs/mylib (on:push)/build ] ⭐ Run actions/setup-node@v1 *DRYRUN* [libs/mylib (on:push)/build ] ☁ git clone 'https://github.com/actions/setup-node' # ref=v1 *DRYRUN* [libs/mylib (on:push)/build ] ✅ Success - actions/setup-node@v1 *DRYRUN* [libs/mylib (on:push)/build ] ⭐ Run 2 panic: runtime error: index out of range [1] with length 0 goroutine 24 [running]: github.com/nektos/act/pkg/runner.newRemoteAction(0x0, 0x0, 0x0) /private/tmp/act-20210112-34242-iay2nt/act-0.2.18/pkg/runner/step_context.go:382 +0x1b9 github.com/nektos/act/pkg/runner.(*StepContext).Executor(0xc0003c2080, 0x19c4762) /private/tmp/act-20210112-34242-iay2nt/act-0.2.18/pkg/runner/step_context.go:59 +0x24c github.com/nektos/act/pkg/runner.(*RunContext).newStepExecutor.func1(0x1add840, 0xc0003be0f0, 0x0, 0x0) /private/tmp/act-20210112-34242-iay2nt/act-0.2.18/pkg/runner/run_context.go:227 +0x3a5 github.com/nektos/act/pkg/common.Executor.Then.func1(0x1add840, 0xc0003be0f0, 0xc000390190, 0xc00030de18) /private/tmp/act-20210112-34242-iay2nt/act-0.2.18/pkg/common/executor.go:146 +0x184 github.com/nektos/act/pkg/common.Executor.Then.func1(0x1add840, 0xc0003be0f0, 0xc0003d4b40, 0xc000390100) /private/tmp/act-20210112-34242-iay2nt/act-0.2.18/pkg/common/executor.go:133 +0x4c github.com/nektos/act/pkg/common.Executor.Then.func1(0x1add840, 0xc0003be0f0, 0x1, 0x1fb22e8) /private/tmp/act-20210112-34242-iay2nt/act-0.2.18/pkg/common/executor.go:133 +0x4c github.com/nektos/act/pkg/common.Executor.If.func1(0x1add840, 0xc0003be0f0, 0xc00049a000, 0x2f) /private/tmp/act-20210112-34242-iay2nt/act-0.2.18/pkg/common/executor.go:154 +0x6a github.com/nektos/act/pkg/runner.(*runnerImpl).NewPlanExecutor.func1(0x1add840, 0xc000399a40, 0xc00007e000, 0xc000383770) /private/tmp/act-20210112-34242-iay2nt/act-0.2.18/pkg/runner/runner.go:79 +0x242 github.com/nektos/act/pkg/common.Executor.ChannelError.func1(0x1add840, 0xc000399a40, 0xc00007e000, 0x0) /private/tmp/act-20210112-34242-iay2nt/act-0.2.18/pkg/common/executor.go:125 +0x45 github.com/nektos/act/pkg/common.NewParallelExecutor.func1.1(0xc00051be40, 0xc0002ce540, 0x1add840, 0xc000399a40) /private/tmp/act-20210112-34242-iay2nt/act-0.2.18/pkg/common/executor.go:101 +0x56 created by github.com/nektos/act/pkg/common.NewParallelExecutor.func1 /private/tmp/act-20210112-34242-iay2nt/act-0.2.18/pkg/common/executor.go:100 +0xb7 ``` All other tasks works fine. Only this one task that make use of `env` has a problem?
kerem closed this issue 2026-03-01 21:42:32 +03:00
Author
Owner

@catthehacker commented on GitHub (Jan 27, 2021):

Remove the unnecessary hyphen in line 17. PR https://github.com/nektos/act/pull/500 (currently in master only) implements error handling for that case and will print information that action syntax is invalid.

<!-- gh-comment-id:768346636 --> @catthehacker commented on GitHub (Jan 27, 2021): Remove the unnecessary hyphen in line 17. PR https://github.com/nektos/act/pull/500 (currently in master only) implements error handling for that case and will print information that action syntax is invalid.
Author
Owner

@dchambers commented on GitHub (Jan 27, 2021):

Yes, it works, thank you 🎉 . It's surprising that GitHub accepts that config at all since my env setting wasn't obviously associated with either a job or a single step. Not sure how I snuck that config past GitHub in retrospect. 😂

<!-- gh-comment-id:768353764 --> @dchambers commented on GitHub (Jan 27, 2021): Yes, it works, thank you 🎉 . It's surprising that GitHub accepts that config at all since my `env` setting wasn't obviously associated with either a job or a single step. Not sure how I snuck that config past GitHub in retrospect. 😂
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#345
No description provided.