# SPDX-FileCopyrightText: 2024-2025 Pagefault Games
#
# SPDX-License-Identifier: AGPL-3.0-only

pre-commit:
  skip:
    - merge
    - rebase
  commands:
    biome-lint:
      # Disable colors as certain IDEs (such as VSCode) don't support it in the output pane.
      # Summary mode looks decent in plain ASCII anyhow
      run: pnpm biome:staged --colors=off --reporter=summary
      stage_fixed: true
    ls-lint:
      run: pnpm exec ls-lint

post-merge:
  commands:
    update-submodules:
      run: pnpm update-submodules
    update-packages:
      run: pnpm i

post-checkout:
  commands:
    update-packages:
      # cf https://git-scm.com/docs/githooks#_post_checkout:
      # The 3rd argument is 1 for branch checkouts and 0 for file checkouts.
      run: if test {3} -eq "1"; then pnpm i; fi
