action icon indicating copy to clipboard operation
action copied to clipboard

Fix check for lockfiles depth

Open stasadev opened this issue 1 year ago • 0 comments

The Issue

At DDEV we run linter before executing this action:

https://github.com/ddev/ddev.com/blob/7a849588830da831a94f356877abee6d08a458a9/.github/workflows/test.yml

jobs:
  build:
    timeout-minutes: 15
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: 20
      - name: Install dependencies
        run: npm ci
      - name: Lint
        run: npm run textlint
      - name: Install, build, and upload your site output
        uses: withastro/action@v2

And your action use find to check for pnpm-lock.yaml, yarn.lock, package-lock.json and bun.lockb without a specific depth, which resulted in:

find "." -name "yarn.lock"
./node_modules/uri-js/yarn.lock

And our tests failed with (we use npm):

Warning: No existing directories found containing cache-dependency-path="./yarn.lock"

How This PR Solves The Issue

Use -maxdepth 1 as it makes no sense to search all subdirectories for lockfiles.

stasadev avatar Apr 23 '24 18:04 stasadev