dorny / paths-filter

Conditionally run actions based on files modified by PR, feature branch or pushed commits
MIT License
2.14k stars 239 forks source link

Error: Unable to locate executable file: git #212

Open phavekes opened 9 months ago

phavekes commented 9 months ago

I use this in my github action:

      # Check for changes in the server component of the Archimate model
      - uses: dorny/paths-filter@v2
        id: changes
        with:
          filters: |
            archi:
              - 'docs/invite.archimate'
            server:
              - 'server/src/**'

This was working fine previously, but now the github action complains about missing the git executable:

Run dorny/paths-filter@v2
Get current git ref
Error: Unable to locate executable file: git. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.
dorny commented 8 months ago

@phavekes This action expects the git executable to be available in the PATH. Which runner do you use? Can you write here value of runs-on field of your job?

wweaver commented 7 months ago

@dorny I'm using v3 and getting this error as well.

Get current git ref
  /usr/bin/git branch --show-current
  fatal: not a git repository (or any of the parent directories): .git
Error: The process '/usr/bin/git' failed with exit code 128
image
jobs:
  changes:
    runs-on: ubuntu-latest
    permissions:
      pull-requests: read
    outputs:
      ...
    steps:
      - uses: dorny/paths-filter@v3
        id: filter
        with:
          filters: |
            ...

What's weird is this is working for me on a pull_request trigger, but it's not working on a push trigger. Could this be github not providing git in the path for push triggers?

corroleaus commented 7 months ago

I'm having the same issue as @wweaver, works fine on PR not after merge with an almost identical yaml. Git is in path as you can see: fatal: not a git repository (or any of the parent directories): .git

That is output from git.

corroleaus commented 7 months ago

Adding checkout such as:

      - uses: actions/checkout@v4
      - uses: dorny/paths-filter@v3
        id: filter
        ....

solved it...

jaisal1024 commented 1 week ago

Having this same issue when using act to test CI locally -> https://github.com/nektos/act