dorny / paths-filter

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

git branch error: unknown option show-current #88

Open alrf opened 3 years ago

alrf commented 3 years ago

Pipeline fails with:

Run dorny/paths-filter@v2.10.1
Get current git ref
  /usr/bin/git branch --show-current
  error: unknown option `show-current'

https://github.com/dorny/paths-filter/blob/78ab00f87740f82aec8ed8826eb4c3c851044126/src/git.ts#L168

git version 2.20.1 is used.

The same issue as for actions/checkout: https://github.com/actions/checkout/issues/121

balazsorban44 commented 3 years ago

We get a similar issue:

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

See: https://github.com/nextauthjs/adapters/runs/2645738825

dorny commented 3 years ago

@alrf: Thanks for reporting the issue. I will use the same workaround as they used in the checkout action.

dorny commented 3 years ago

@balazsorban44: The error you get is not related to this issue. You are using paths-filter in a workflow triggered by push event. In this case, you have to use the checkout@v2 step before paths-filter. Without checkout it works only for workflows triggered by a pull request event.

scottwn commented 1 year ago

We're seeing the same show-current error on certain buster and centos images using checkout@v3 https://github.com/AgnostiqHQ/covalent/runs/7530228427