withastro / action

A GitHub Action that deploys your Astro project to GitHub Pages
Other
143 stars 31 forks source link

Fix check for lockfiles depth #52

Closed stasadev closed 1 month ago

stasadev commented 2 months ago

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.