[GH-ISSUE #510] Error when trying to use git. #351

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

Originally created by @Ayfri on GitHub (Jan 30, 2021).
Original GitHub issue: https://github.com/nektos/act/issues/510

Hi, I have this action:

name: Generate Documentation

on:
  workflow_dispatch:
  push:
    paths:
    - '**.ts'
    branches:
    - master

jobs:
  genDocs:
    name: Generate Documentation
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: Install Node.js
        uses: actions/setup-node@v1
        with:
          node-version: 14

      - name: Install Dependencies
        run: |
          npm ci

      - name: Format & Lint
        run: |
          npm run prettier
          npm run lint

      - name: Generate Documentation
        run: npm run genDocs

      - name: Commit changes
      - run: git init
      - run: git config --global user.email "actions@github.com"
      - run: git config --global user.name "GitHub Action"
      - run: git add *
      - run: git pull
      - run: git commit --amend --no-edit
      - run: git push origin -f

And I'm getting this error:

panic: runtime error: index out of range [1] with length 0

goroutine 8 [running]:
github.com/nektos/act/pkg/runner.newRemoteAction(0x0, 0x0, 0x0)
        /home/runner/work/act/act/pkg/runner/step_context.go:408 +0x189
github.com/nektos/act/pkg/runner.(*StepContext).Executor(0xc00047a940, 0xde001b)
        /home/runner/work/act/act/pkg/runner/step_context.go:59 +0x249
github.com/nektos/act/pkg/runner.(*RunContext).newStepExecutor.func1(0xf42540, 0xc000467890, 0x0, 0x0)
        /home/runner/work/act/act/pkg/runner/run_context.go:223 +0x37f
github.com/nektos/act/pkg/common.Executor.Then.func1(0xf42540, 0xc000467890, 0x0, 0x10)
        /home/runner/work/act/act/pkg/common/executor.go:146 +0x181
github.com/nektos/act/pkg/common.Executor.Then.func1(0xf42540, 0xc000467890, 0xc9a320, 0xd)
        /home/runner/work/act/act/pkg/common/executor.go:133 +0x53
github.com/nektos/act/pkg/common.Executor.Then.func1(0xf42540, 0xc000467890, 0x2, 0xc000115b68)
        /home/runner/work/act/act/pkg/common/executor.go:133 +0x53
github.com/nektos/act/pkg/common.Executor.Then.func1(0xf42540, 0xc000467890, 0xd, 0x0)
        /home/runner/work/act/act/pkg/common/executor.go:133 +0x53
github.com/nektos/act/pkg/common.Executor.Then.func1(0xf42540, 0xc000467890, 0xc000115b01, 0xc000115c88)
        /home/runner/work/act/act/pkg/common/executor.go:133 +0x53
github.com/nektos/act/pkg/common.Executor.Then.func1(0xf42540, 0xc000467890, 0xc000462be0, 0xda2c20)
        /home/runner/work/act/act/pkg/common/executor.go:133 +0x53
github.com/nektos/act/pkg/common.Executor.Then.func1(0xf42540, 0xc000467890, 0xc0002a4fd1, 0x1e)
        /home/runner/work/act/act/pkg/common/executor.go:133 +0x53
github.com/nektos/act/pkg/common.Executor.Then.func1(0xf42540, 0xc000467890, 0xc9a320, 0xc000462bd0)
        /home/runner/work/act/act/pkg/common/executor.go:133 +0x53
github.com/nektos/act/pkg/common.Executor.Then.func1(0xf42540, 0xc000467890, 0x1, 0x1554668)
        /home/runner/work/act/act/pkg/common/executor.go:133 +0x53
github.com/nektos/act/pkg/common.Executor.If.func1(0xf42540, 0xc000467890, 0xc0002a5920, 0x2d)
        /home/runner/work/act/act/pkg/common/executor.go:154 +0x71
github.com/nektos/act/pkg/runner.(*runnerImpl).NewPlanExecutor.func1(0xf42540, 0xc0004280f0, 0xc000500080, 0xc000069f70)
        /home/runner/work/act/act/pkg/runner/runner.go:79 +0x263
github.com/nektos/act/pkg/common.Executor.ChannelError.func1(0xf42540, 0xc0004280f0, 0xc000500080, 0x0)
        /home/runner/work/act/act/pkg/common/executor.go:125 +0x4c
github.com/nektos/act/pkg/common.NewParallelExecutor.func1.1(0xc000500040, 0xc00044c120, 0xf42540, 0xc0004280f0)
        /home/runner/work/act/act/pkg/common/executor.go:101 +0x5d
created by github.com/nektos/act/pkg/common.NewParallelExecutor.func1
        /home/runner/work/act/act/pkg/common/executor.go:100 +0xbe

At the commit changes step.

Originally created by @Ayfri on GitHub (Jan 30, 2021). Original GitHub issue: https://github.com/nektos/act/issues/510 Hi, I have this action: ```yml name: Generate Documentation on: workflow_dispatch: push: paths: - '**.ts' branches: - master jobs: genDocs: name: Generate Documentation runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Install Node.js uses: actions/setup-node@v1 with: node-version: 14 - name: Install Dependencies run: | npm ci - name: Format & Lint run: | npm run prettier npm run lint - name: Generate Documentation run: npm run genDocs - name: Commit changes - run: git init - run: git config --global user.email "actions@github.com" - run: git config --global user.name "GitHub Action" - run: git add * - run: git pull - run: git commit --amend --no-edit - run: git push origin -f ``` And I'm getting this error: ```go panic: runtime error: index out of range [1] with length 0 goroutine 8 [running]: github.com/nektos/act/pkg/runner.newRemoteAction(0x0, 0x0, 0x0) /home/runner/work/act/act/pkg/runner/step_context.go:408 +0x189 github.com/nektos/act/pkg/runner.(*StepContext).Executor(0xc00047a940, 0xde001b) /home/runner/work/act/act/pkg/runner/step_context.go:59 +0x249 github.com/nektos/act/pkg/runner.(*RunContext).newStepExecutor.func1(0xf42540, 0xc000467890, 0x0, 0x0) /home/runner/work/act/act/pkg/runner/run_context.go:223 +0x37f github.com/nektos/act/pkg/common.Executor.Then.func1(0xf42540, 0xc000467890, 0x0, 0x10) /home/runner/work/act/act/pkg/common/executor.go:146 +0x181 github.com/nektos/act/pkg/common.Executor.Then.func1(0xf42540, 0xc000467890, 0xc9a320, 0xd) /home/runner/work/act/act/pkg/common/executor.go:133 +0x53 github.com/nektos/act/pkg/common.Executor.Then.func1(0xf42540, 0xc000467890, 0x2, 0xc000115b68) /home/runner/work/act/act/pkg/common/executor.go:133 +0x53 github.com/nektos/act/pkg/common.Executor.Then.func1(0xf42540, 0xc000467890, 0xd, 0x0) /home/runner/work/act/act/pkg/common/executor.go:133 +0x53 github.com/nektos/act/pkg/common.Executor.Then.func1(0xf42540, 0xc000467890, 0xc000115b01, 0xc000115c88) /home/runner/work/act/act/pkg/common/executor.go:133 +0x53 github.com/nektos/act/pkg/common.Executor.Then.func1(0xf42540, 0xc000467890, 0xc000462be0, 0xda2c20) /home/runner/work/act/act/pkg/common/executor.go:133 +0x53 github.com/nektos/act/pkg/common.Executor.Then.func1(0xf42540, 0xc000467890, 0xc0002a4fd1, 0x1e) /home/runner/work/act/act/pkg/common/executor.go:133 +0x53 github.com/nektos/act/pkg/common.Executor.Then.func1(0xf42540, 0xc000467890, 0xc9a320, 0xc000462bd0) /home/runner/work/act/act/pkg/common/executor.go:133 +0x53 github.com/nektos/act/pkg/common.Executor.Then.func1(0xf42540, 0xc000467890, 0x1, 0x1554668) /home/runner/work/act/act/pkg/common/executor.go:133 +0x53 github.com/nektos/act/pkg/common.Executor.If.func1(0xf42540, 0xc000467890, 0xc0002a5920, 0x2d) /home/runner/work/act/act/pkg/common/executor.go:154 +0x71 github.com/nektos/act/pkg/runner.(*runnerImpl).NewPlanExecutor.func1(0xf42540, 0xc0004280f0, 0xc000500080, 0xc000069f70) /home/runner/work/act/act/pkg/runner/runner.go:79 +0x263 github.com/nektos/act/pkg/common.Executor.ChannelError.func1(0xf42540, 0xc0004280f0, 0xc000500080, 0x0) /home/runner/work/act/act/pkg/common/executor.go:125 +0x4c github.com/nektos/act/pkg/common.NewParallelExecutor.func1.1(0xc000500040, 0xc00044c120, 0xf42540, 0xc0004280f0) /home/runner/work/act/act/pkg/common/executor.go:101 +0x5d created by github.com/nektos/act/pkg/common.NewParallelExecutor.func1 /home/runner/work/act/act/pkg/common/executor.go:100 +0xbe ``` At the `commit changes` step.
kerem closed this issue 2026-03-01 21:42:35 +03:00
Author
Owner

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

Duplicate of #504
Remove unnecessary hyphen on line 36
bad:

      - name: Commit changes
      - run: git init

good:

      - name: Commit changes
        run: git init

You should consider using this format for running multiple commands in one step:

      - name: Commit changes
        run: |
             git init
             git config --global user.email "actions@github.com"
             git config --global user.name "GitHub Action"
             git add *
             git pull
             git commit --amend --no-edit
             git push origin -f
<!-- gh-comment-id:770218702 --> @catthehacker commented on GitHub (Jan 30, 2021): Duplicate of #504 Remove unnecessary hyphen on line 36 bad: ```yaml - name: Commit changes - run: git init ``` good: ```yaml - name: Commit changes run: git init ``` You should consider using this format for running multiple commands in one step: ```yaml - name: Commit changes run: | git init git config --global user.email "actions@github.com" git config --global user.name "GitHub Action" git add * git pull git commit --amend --no-edit git push origin -f ```
Author
Owner

@Ayfri commented on GitHub (Jan 30, 2021):

Now I'm getting this error:

panic: runtime error: index out of range [1] with length 0

goroutine 8 [running]:
github.com/nektos/act/pkg/runner.newRemoteAction(0x0, 0x0, 0x0)
        /home/runner/work/act/act/pkg/runner/step_context.go:408 +0x189
github.com/nektos/act/pkg/runner.(*StepContext).Executor(0xc000476980, 0xde001b)
        /home/runner/work/act/act/pkg/runner/step_context.go:59 +0x249
github.com/nektos/act/pkg/runner.(*RunContext).newStepExecutor.func1(0xf42540, 0xc000461890, 0x0, 0x0)
        /home/runner/work/act/act/pkg/runner/run_context.go:223 +0x37f
github.com/nektos/act/pkg/common.Executor.Then.func1(0xf42540, 0xc000461890, 0xc0002a6fd1, 0x1e)
        /home/runner/work/act/act/pkg/common/executor.go:146 +0x181
github.com/nektos/act/pkg/common.Executor.Then.func1(0xf42540, 0xc000461890, 0xc9a320, 0xc000464980)
        /home/runner/work/act/act/pkg/common/executor.go:133 +0x53
github.com/nektos/act/pkg/common.Executor.Then.func1(0xf42540, 0xc000461890, 0x1, 0x1554668)
        /home/runner/work/act/act/pkg/common/executor.go:133 +0x53
github.com/nektos/act/pkg/common.Executor.If.func1(0xf42540, 0xc000461890, 0xc0002a78f0, 0x2d)
        /home/runner/work/act/act/pkg/common/executor.go:154 +0x71
github.com/nektos/act/pkg/runner.(*runnerImpl).NewPlanExecutor.func1(0xf42540, 0xc0004260f0, 0xc00047e060, 0xc000069f70)
        /home/runner/work/act/act/pkg/runner/runner.go:79 +0x263
github.com/nektos/act/pkg/common.Executor.ChannelError.func1(0xf42540, 0xc0004260f0, 0xc00047e060, 0x0)
        /home/runner/work/act/act/pkg/common/executor.go:125 +0x4c
github.com/nektos/act/pkg/common.NewParallelExecutor.func1.1(0xc00047e020, 0xc00044a120, 0xf42540, 0xc0004260f0)
        /home/runner/work/act/act/pkg/common/executor.go:101 +0x5d
created by github.com/nektos/act/pkg/common.NewParallelExecutor.func1
        /home/runner/work/act/act/pkg/common/executor.go:100 +0xbe
<!-- gh-comment-id:770221542 --> @Ayfri commented on GitHub (Jan 30, 2021): Now I'm getting this error: ```go panic: runtime error: index out of range [1] with length 0 goroutine 8 [running]: github.com/nektos/act/pkg/runner.newRemoteAction(0x0, 0x0, 0x0) /home/runner/work/act/act/pkg/runner/step_context.go:408 +0x189 github.com/nektos/act/pkg/runner.(*StepContext).Executor(0xc000476980, 0xde001b) /home/runner/work/act/act/pkg/runner/step_context.go:59 +0x249 github.com/nektos/act/pkg/runner.(*RunContext).newStepExecutor.func1(0xf42540, 0xc000461890, 0x0, 0x0) /home/runner/work/act/act/pkg/runner/run_context.go:223 +0x37f github.com/nektos/act/pkg/common.Executor.Then.func1(0xf42540, 0xc000461890, 0xc0002a6fd1, 0x1e) /home/runner/work/act/act/pkg/common/executor.go:146 +0x181 github.com/nektos/act/pkg/common.Executor.Then.func1(0xf42540, 0xc000461890, 0xc9a320, 0xc000464980) /home/runner/work/act/act/pkg/common/executor.go:133 +0x53 github.com/nektos/act/pkg/common.Executor.Then.func1(0xf42540, 0xc000461890, 0x1, 0x1554668) /home/runner/work/act/act/pkg/common/executor.go:133 +0x53 github.com/nektos/act/pkg/common.Executor.If.func1(0xf42540, 0xc000461890, 0xc0002a78f0, 0x2d) /home/runner/work/act/act/pkg/common/executor.go:154 +0x71 github.com/nektos/act/pkg/runner.(*runnerImpl).NewPlanExecutor.func1(0xf42540, 0xc0004260f0, 0xc00047e060, 0xc000069f70) /home/runner/work/act/act/pkg/runner/runner.go:79 +0x263 github.com/nektos/act/pkg/common.Executor.ChannelError.func1(0xf42540, 0xc0004260f0, 0xc00047e060, 0x0) /home/runner/work/act/act/pkg/common/executor.go:125 +0x4c github.com/nektos/act/pkg/common.NewParallelExecutor.func1.1(0xc00047e020, 0xc00044a120, 0xf42540, 0xc0004260f0) /home/runner/work/act/act/pkg/common/executor.go:101 +0x5d created by github.com/nektos/act/pkg/common.NewParallelExecutor.func1 /home/runner/work/act/act/pkg/common/executor.go:100 +0xbe ```
Author
Owner

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

@Ayfri can you check my example again, I fixed the typo

<!-- gh-comment-id:770222029 --> @catthehacker commented on GitHub (Jan 30, 2021): @Ayfri can you check my example again, I fixed the typo
Author
Owner

@Ayfri commented on GitHub (Jan 30, 2021):

Okay, it was my fault, I forgot to remove the -.

<!-- gh-comment-id:770223090 --> @Ayfri commented on GitHub (Jan 30, 2021): Okay, it was my fault, I forgot to remove the `-`.
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#351
No description provided.