[GH-ISSUE #1272] Act fails running pre-commit #694

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

Originally created by @richtong on GitHub (Jul 22, 2022).
Original GitHub issue: https://github.com/nektos/act/issues/1272

Bug report info

act version:            0.2.26
GOOS:                   darwin
GOARCH:                 arm64
NumCPU:                 10
Docker host:            DOCKER_HOST environment variable is unset/empty.
Sockets found:
	/var/run/docker.sock
	/Users/rich/.colima/docker.sock
Config files:
	/Users/rich/.actrc:
		-P ubuntu-latest=ghcr.io/catthehacker/ubuntu:act-latest
		-P ubuntu-20.04=ghcr.io/catthehacker/ubuntu:act-20.04
		-P ubuntu-18.04=ghcr.io/catthehacker/ubuntu:act-18.04
Docker Engine:
	Engine version:        20.10.16
	Engine runtime:        runc
	Cgroup version:        2
	Cgroup driver:         cgroupfs
	Storage driver:        overlay2
	Registry URI:          https://index.docker.io/v1/
	OS:                    Docker Desktop
	OS type:               linux
	OS version:
	OS arch:               aarch64
	OS kernel:             5.10.104-linuxkit
	OS CPU:                4
	OS memory:             15972 MB
	Security options:
		name=seccomp,profile=default
		name=cgroupns

Command used with act

act -j pre-commit -v

Describe issue

I run a git pre-commit with .pre-commit-config.yaml and use the action pre-commit/action@v3.0.0

Unfortunately while this work on Github.com it fails with act with an error message that it does not see this repo as a git repo which is pretty strange so how can I tell if git is properly installed?

Working directory '/Users/rich/ws/git/src/bin'
| An error has occurred: FatalError: git failed. Is it installed, and are you in a Git repository directory?

https://github.com/richtong/bin

Workflow content

pre-commit:
    runs-on: ubuntu-20.04
    steps:
      - name: Checkout action
        uses: actions/checkout@v3
        with:
          lfs: true
          # submodules should be tested one at a time
          # submodules: recursive
      # pre-commit needs python
      - name: Setup python
        uses: actions/setup-python@v3
        with:
          python-version: 3.9
      # # https://snapcraft.io/install/shfmt/ubuntu
      # Using snapd fails on act so instead use pre-commit
      # that does its own installation rather than needing shfmt
      #- name: Install shfmt
      #  run: |
      #    sudo apt-get update && \
      #    sudo apt-get install snapd && \
      #    sudo snap install shfmt
      # install dependencies for ruby gem mdl
      # we use markdownlint now instead not the ruby gem mdl
      # https://github.com/ruby/setup-ruby
      # - name: Install ruby
      # #uses: ruby/setup-ruby@v1
      # #with:
      #   #ruby-version: 3.0
      # - name: Install Gems
      # #run: |
      #   #gem install mdl
      - name: Install node
        uses: actions/setup-node@v2
        with:
          node-version: '14'
      - name: Install markdownlint-cli
        run: npm install -g markdownlint-cli
      # https://github.com/marketplace/actions/github-action-for-homebrew
      # brew not found in act so used dockerized version in pre-commit
      # - name: Install homebrew
      #   uses: artemnovichkov/action-homebrew@0.1.0
      # - name: Install hadolint
      #  run: brew install hadolint

      # https://github.com/pre-commit/action
      # if you are using public repo then you can use pre-commit.ci
      # as a marketplace applications
      - name: Run Pre-commit
        uses: pre-commit/action@v3.0.0

Relevant log output

[Python and Pre-commit/pre-commit] setupEnv => map[ACT:true AGENT_TOOLSDIRECTORY:/opt/hostedtoolcache CI:true DEBIAN_FRONTEND:noninteractive DEPLOYMENT_BASEPATH:/opt/runner GITHUB_ACTION:3 GITHUB_ACTIONS:true GITHUB_ACTION_PATH:/var/run/act/actions/pre-commit-action@v3.0.0 GITHUB_ACTION_REF:v3.0.0 GITHUB_ACTION_REPOSITORY:action GITHUB_ACTOR:nektos/act GITHUB_API_URL:https://api.github.com GITHUB_BASE_REF: GITHUB_ENV:/var/run/act/workflow/envs.txt GITHUB_EVENT_NAME:push GITHUB_EVENT_PATH:/var/run/act/workflow/event.json GITHUB_GRAPHQL_URL:https://api.github.com/graphql GITHUB_HEAD_REF: GITHUB_JOB:pre-commit GITHUB_PATH:/var/run/act/workflow/paths.txt GITHUB_REF:refs/heads/rich-src GITHUB_REPOSITORY:richtong/src GITHUB_REPOSITORY_OWNER:richtong GITHUB_RETENTION_DAYS:0 GITHUB_RUN_ID:1 GITHUB_RUN_NUMBER:1 GITHUB_SERVER_URL:https://github.com GITHUB_SHA:37bb6ab8200e04cf460cb80f05dfa76d6764e582 GITHUB_TOKEN: GITHUB_WORKFLOW:Python and Pre-commit GITHUB_WORKSPACE:/Users/rich/ws/git/src/bin IMAGE_OS:ubuntu20 ImageOS:ubuntu20 LD_LIBRARY_PATH:/opt/hostedtoolcache/Python/3.9.13/x64/lib LSB_OS_VERSION:2004 LSB_RELEASE:20.04 PATH:/opt/hostedtoolcache/node/14.20.0/x64/bin:/opt/hostedtoolcache/Python/3.9.13/x64/bin:/opt/hostedtoolcache/Python/3.9.13/x64:/opt/hostedtoolcache/node/14.20.0/x64/bin:/opt/hostedtoolcache/Python/3.9.13/x64/bin:/opt/hostedtoolcache/Python/3.9.13/x64:/opt/hostedtoolcache/node/14.20.0/x64/bin:/opt/hostedtoolcache/Python/3.9.13/x64/bin:/opt/hostedtoolcache/Python/3.9.13/x64:/opt/hostedtoolcache/node/14.20.0/x64/bin:/opt/hostedtoolcache/Python/3.9.13/x64/bin:/opt/hostedtoolcache/Python/3.9.13/x64:/opt/hostedtoolcache/node/14.20.0/x64/bin:/opt/hostedtoolcache/Python/3.9.13/x64/bin:/opt/hostedtoolcache/Python/3.9.13/x64:/opt/hostedtoolcache/node/14.20.0/x64/bin:/opt/hostedtoolcache/Python/3.9.13/x64/bin:/opt/hostedtoolcache/Python/3.9.13/x64:/opt/hostedtoolcache/Python/3.9.13/x64/bin:/opt/hostedtoolcache/Python/3.9.13/x64:/opt/hostedtoolcache/node/16.16.0/x64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin RUNNER_PERFLOG:/dev/null RUNNER_TRACKING_ID: RUNNER_USER:root RUN_TOOL_CACHE:/opt/hostedtoolcache USER:root pythonLocation:/opt/hostedtoolcache/Python/3.9.13/x64]
[Python and Pre-commit/pre-commit] ⭐  Run pre-commit run --show-diff-on-failure --color=always ${{ inputs.extra_args }}
DEBU[0096] expression 'pre-commit run --show-diff-on-failure --color=always ${{ inputs.extra_args }}' rewritten to 'format('pre-commit run --show-diff-on-failure --color=always {0}', inputs.extra_args)'
DEBU[0096] evaluating expression 'format('pre-commit run --show-diff-on-failure --color=always {0}', inputs.extra_args)'
DEBU[0096] expression 'format('pre-commit run --show-diff-on-failure --color=always {0}', inputs.extra_args)' evaluated to '%!t(string=pre-commit run --show-diff-on-failure --color=always --all-files)'
DEBU[0096] Wrote command

pre-commit run --show-diff-on-failure --color=always --all-files

 to 'workflow/4-composite-3.sh'
DEBU[0096] Writing entry to tarball workflow/4-composite-3.sh len:66
[Python and Pre-commit/pre-commit] Extracting content to '/var/run/act'
[Python and Pre-commit/pre-commit]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/4-composite-3.sh] user= workdir=
[Python and Pre-commit/pre-commit] Exec command '[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/4-composite-3.sh]'
[Python and Pre-commit/pre-commit] Working directory '/Users/rich/ws/git/src/bin'
| An error has occurred: FatalError: git failed. Is it installed, and are you in a Git repository directory?
| Check the log at /root/.cache/pre-commit/pre-commit.log
[Python and Pre-commit/pre-commit]   ❌  Failure - pre-commit run --show-diff-on-failure --color=always ${{ inputs.extra_args }}
[Python and Pre-commit/pre-commit] exit with `FAILURE`: 1
DEBU[0097] Loading slug from git directory '/Users/rich/ws/git/src/.git'
DEBU[0097] Loading revision from git directory '/Users/rich/ws/git/src/.git'
DEBU[0097] Found revision: 37bb6ab8200e04cf460cb80f05dfa76d6764e582
DEBU[0097] HEAD points to '37bb6ab8200e04cf460cb80f05dfa76d6764e582'
DEBU[0097] using github ref: refs/heads/rich-src
DEBU[0097] Found revision: 37bb6ab8200e04cf460cb80f05dfa76d6764e582
[Python and Pre-commit/pre-commit]   ❌  Failure - Run Pre-commit
[Python and Pre-commit/pre-commit] exit with `FAILURE`: 1
DEBU[0097] Loading slug from git directory '/Users/rich/ws/git/src/.git'
DEBU[0097] Loading revision from git directory '/Users/rich/ws/git/src/.git'
DEBU[0097] Found revision: 37bb6ab8200e04cf460cb80f05dfa76d6764e582
DEBU[0097] HEAD points to '37bb6ab8200e04cf460cb80f05dfa76d6764e582'
DEBU[0097] using github ref: refs/heads/rich-src
DEBU[0097] Found revision: 37bb6ab8200e04cf460cb80f05dfa76d6764e582

Additional information

No response

Originally created by @richtong on GitHub (Jul 22, 2022). Original GitHub issue: https://github.com/nektos/act/issues/1272 ### Bug report info ```plain text act version: 0.2.26 GOOS: darwin GOARCH: arm64 NumCPU: 10 Docker host: DOCKER_HOST environment variable is unset/empty. Sockets found: /var/run/docker.sock /Users/rich/.colima/docker.sock Config files: /Users/rich/.actrc: -P ubuntu-latest=ghcr.io/catthehacker/ubuntu:act-latest -P ubuntu-20.04=ghcr.io/catthehacker/ubuntu:act-20.04 -P ubuntu-18.04=ghcr.io/catthehacker/ubuntu:act-18.04 Docker Engine: Engine version: 20.10.16 Engine runtime: runc Cgroup version: 2 Cgroup driver: cgroupfs Storage driver: overlay2 Registry URI: https://index.docker.io/v1/ OS: Docker Desktop OS type: linux OS version: OS arch: aarch64 OS kernel: 5.10.104-linuxkit OS CPU: 4 OS memory: 15972 MB Security options: name=seccomp,profile=default name=cgroupns ``` ### Command used with act ```sh act -j pre-commit -v ``` ### Describe issue I run a git pre-commit with .pre-commit-config.yaml and use the action pre-commit/action@v3.0.0 Unfortunately while this work on Github.com it fails with act with an error message that it does not see this repo as a git repo which is pretty strange so how can I tell if git is properly installed? ``` Working directory '/Users/rich/ws/git/src/bin' | An error has occurred: FatalError: git failed. Is it installed, and are you in a Git repository directory? ``` ### Link to GitHub repository https://github.com/richtong/bin ### Workflow content ```yml pre-commit: runs-on: ubuntu-20.04 steps: - name: Checkout action uses: actions/checkout@v3 with: lfs: true # submodules should be tested one at a time # submodules: recursive # pre-commit needs python - name: Setup python uses: actions/setup-python@v3 with: python-version: 3.9 # # https://snapcraft.io/install/shfmt/ubuntu # Using snapd fails on act so instead use pre-commit # that does its own installation rather than needing shfmt #- name: Install shfmt # run: | # sudo apt-get update && \ # sudo apt-get install snapd && \ # sudo snap install shfmt # install dependencies for ruby gem mdl # we use markdownlint now instead not the ruby gem mdl # https://github.com/ruby/setup-ruby # - name: Install ruby # #uses: ruby/setup-ruby@v1 # #with: # #ruby-version: 3.0 # - name: Install Gems # #run: | # #gem install mdl - name: Install node uses: actions/setup-node@v2 with: node-version: '14' - name: Install markdownlint-cli run: npm install -g markdownlint-cli # https://github.com/marketplace/actions/github-action-for-homebrew # brew not found in act so used dockerized version in pre-commit # - name: Install homebrew # uses: artemnovichkov/action-homebrew@0.1.0 # - name: Install hadolint # run: brew install hadolint # https://github.com/pre-commit/action # if you are using public repo then you can use pre-commit.ci # as a marketplace applications - name: Run Pre-commit uses: pre-commit/action@v3.0.0 ``` ### Relevant log output ```sh [Python and Pre-commit/pre-commit] setupEnv => map[ACT:true AGENT_TOOLSDIRECTORY:/opt/hostedtoolcache CI:true DEBIAN_FRONTEND:noninteractive DEPLOYMENT_BASEPATH:/opt/runner GITHUB_ACTION:3 GITHUB_ACTIONS:true GITHUB_ACTION_PATH:/var/run/act/actions/pre-commit-action@v3.0.0 GITHUB_ACTION_REF:v3.0.0 GITHUB_ACTION_REPOSITORY:action GITHUB_ACTOR:nektos/act GITHUB_API_URL:https://api.github.com GITHUB_BASE_REF: GITHUB_ENV:/var/run/act/workflow/envs.txt GITHUB_EVENT_NAME:push GITHUB_EVENT_PATH:/var/run/act/workflow/event.json GITHUB_GRAPHQL_URL:https://api.github.com/graphql GITHUB_HEAD_REF: GITHUB_JOB:pre-commit GITHUB_PATH:/var/run/act/workflow/paths.txt GITHUB_REF:refs/heads/rich-src GITHUB_REPOSITORY:richtong/src GITHUB_REPOSITORY_OWNER:richtong GITHUB_RETENTION_DAYS:0 GITHUB_RUN_ID:1 GITHUB_RUN_NUMBER:1 GITHUB_SERVER_URL:https://github.com GITHUB_SHA:37bb6ab8200e04cf460cb80f05dfa76d6764e582 GITHUB_TOKEN: GITHUB_WORKFLOW:Python and Pre-commit GITHUB_WORKSPACE:/Users/rich/ws/git/src/bin IMAGE_OS:ubuntu20 ImageOS:ubuntu20 LD_LIBRARY_PATH:/opt/hostedtoolcache/Python/3.9.13/x64/lib LSB_OS_VERSION:2004 LSB_RELEASE:20.04 PATH:/opt/hostedtoolcache/node/14.20.0/x64/bin:/opt/hostedtoolcache/Python/3.9.13/x64/bin:/opt/hostedtoolcache/Python/3.9.13/x64:/opt/hostedtoolcache/node/14.20.0/x64/bin:/opt/hostedtoolcache/Python/3.9.13/x64/bin:/opt/hostedtoolcache/Python/3.9.13/x64:/opt/hostedtoolcache/node/14.20.0/x64/bin:/opt/hostedtoolcache/Python/3.9.13/x64/bin:/opt/hostedtoolcache/Python/3.9.13/x64:/opt/hostedtoolcache/node/14.20.0/x64/bin:/opt/hostedtoolcache/Python/3.9.13/x64/bin:/opt/hostedtoolcache/Python/3.9.13/x64:/opt/hostedtoolcache/node/14.20.0/x64/bin:/opt/hostedtoolcache/Python/3.9.13/x64/bin:/opt/hostedtoolcache/Python/3.9.13/x64:/opt/hostedtoolcache/node/14.20.0/x64/bin:/opt/hostedtoolcache/Python/3.9.13/x64/bin:/opt/hostedtoolcache/Python/3.9.13/x64:/opt/hostedtoolcache/Python/3.9.13/x64/bin:/opt/hostedtoolcache/Python/3.9.13/x64:/opt/hostedtoolcache/node/16.16.0/x64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin RUNNER_PERFLOG:/dev/null RUNNER_TRACKING_ID: RUNNER_USER:root RUN_TOOL_CACHE:/opt/hostedtoolcache USER:root pythonLocation:/opt/hostedtoolcache/Python/3.9.13/x64] [Python and Pre-commit/pre-commit] ⭐ Run pre-commit run --show-diff-on-failure --color=always ${{ inputs.extra_args }} DEBU[0096] expression 'pre-commit run --show-diff-on-failure --color=always ${{ inputs.extra_args }}' rewritten to 'format('pre-commit run --show-diff-on-failure --color=always {0}', inputs.extra_args)' DEBU[0096] evaluating expression 'format('pre-commit run --show-diff-on-failure --color=always {0}', inputs.extra_args)' DEBU[0096] expression 'format('pre-commit run --show-diff-on-failure --color=always {0}', inputs.extra_args)' evaluated to '%!t(string=pre-commit run --show-diff-on-failure --color=always --all-files)' DEBU[0096] Wrote command pre-commit run --show-diff-on-failure --color=always --all-files to 'workflow/4-composite-3.sh' DEBU[0096] Writing entry to tarball workflow/4-composite-3.sh len:66 [Python and Pre-commit/pre-commit] Extracting content to '/var/run/act' [Python and Pre-commit/pre-commit] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/4-composite-3.sh] user= workdir= [Python and Pre-commit/pre-commit] Exec command '[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/4-composite-3.sh]' [Python and Pre-commit/pre-commit] Working directory '/Users/rich/ws/git/src/bin' | An error has occurred: FatalError: git failed. Is it installed, and are you in a Git repository directory? | Check the log at /root/.cache/pre-commit/pre-commit.log [Python and Pre-commit/pre-commit] ❌ Failure - pre-commit run --show-diff-on-failure --color=always ${{ inputs.extra_args }} [Python and Pre-commit/pre-commit] exit with `FAILURE`: 1 DEBU[0097] Loading slug from git directory '/Users/rich/ws/git/src/.git' DEBU[0097] Loading revision from git directory '/Users/rich/ws/git/src/.git' DEBU[0097] Found revision: 37bb6ab8200e04cf460cb80f05dfa76d6764e582 DEBU[0097] HEAD points to '37bb6ab8200e04cf460cb80f05dfa76d6764e582' DEBU[0097] using github ref: refs/heads/rich-src DEBU[0097] Found revision: 37bb6ab8200e04cf460cb80f05dfa76d6764e582 [Python and Pre-commit/pre-commit] ❌ Failure - Run Pre-commit [Python and Pre-commit/pre-commit] exit with `FAILURE`: 1 DEBU[0097] Loading slug from git directory '/Users/rich/ws/git/src/.git' DEBU[0097] Loading revision from git directory '/Users/rich/ws/git/src/.git' DEBU[0097] Found revision: 37bb6ab8200e04cf460cb80f05dfa76d6764e582 DEBU[0097] HEAD points to '37bb6ab8200e04cf460cb80f05dfa76d6764e582' DEBU[0097] using github ref: refs/heads/rich-src DEBU[0097] Found revision: 37bb6ab8200e04cf460cb80f05dfa76d6764e582 ``` ### Additional information _No response_
kerem 2026-03-01 21:45:35 +03:00
Author
Owner

@github-actions[bot] commented on GitHub (Aug 22, 2022):

Issue is stale and will be closed in 14 days unless there is new activity

<!-- gh-comment-id:1221652572 --> @github-actions[bot] commented on GitHub (Aug 22, 2022): Issue is stale and will be closed in 14 days unless there is new activity
Author
Owner

@richtong commented on GitHub (Aug 22, 2022):

Help not sure how to debug this.

Sent via Superhuman iOS ( @.*** )

On Sun, Aug 21 2022 at 17:12, github-actions[bot] < @.*** > wrote:

Issue is stale and will be closed in 14 days unless there is new activity


Reply to this email directly, view it on GitHub (
https://github.com/nektos/act/issues/1272#issuecomment-1221652572 ) , or unsubscribe
(
https://github.com/notifications/unsubscribe-auth/AANTCR5FDG6LDHYP7SOY7OTV2LAWRANCNFSM54MUILCQ
).
You are receiving this because you authored the thread. Message ID: <nektos/act/issues/1272/1221652572
@ github. com>

<!-- gh-comment-id:1221656589 --> @richtong commented on GitHub (Aug 22, 2022): Help not sure how to debug this. Sent via Superhuman iOS ( ***@***.*** ) On Sun, Aug 21 2022 at 17:12, github-actions[bot] < ***@***.*** > wrote: > > > > > > > > Issue is stale and will be closed in 14 days unless there is new activity > > > > — > Reply to this email directly, view it on GitHub ( > https://github.com/nektos/act/issues/1272#issuecomment-1221652572 ) , or unsubscribe > ( > https://github.com/notifications/unsubscribe-auth/AANTCR5FDG6LDHYP7SOY7OTV2LAWRANCNFSM54MUILCQ > ). > You are receiving this because you authored the thread. Message ID: <nektos/act/issues/1272/1221652572 > @ github. com> > > >
Author
Owner

@github-actions[bot] commented on GitHub (Sep 22, 2022):

Issue is stale and will be closed in 14 days unless there is new activity

<!-- gh-comment-id:1254355589 --> @github-actions[bot] commented on GitHub (Sep 22, 2022): Issue is stale and will be closed in 14 days unless there is new activity
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#694
No description provided.