Ver Fonte

chore: wire up pre-commit to run `turbo fix` on changed packages

Connor Prussin há 8 meses atrás
pai
commit
c74bdf096b
2 ficheiros alterados com 17 adições e 0 exclusões
  1. 12 0
      .github/workflows/ci-pre-commit.yml
  2. 5 0
      .pre-commit-config.yaml

+ 12 - 0
.github/workflows/ci-pre-commit.yml

@@ -68,4 +68,16 @@ jobs:
           sudo mv aptos /usr/local/bin/
           chmod +x /usr/local/bin/aptos
           aptos update movefmt
+      - uses: actions/setup-node@v4
+        with:
+          node-version-file: "package.json"
+      # Libusb is a build requirement for the node-hid package and so pnpm
+      # install will fail if this isn't in the build environment and if a
+      # precompiled binary isn't found.
+      - name: Install libusb
+        run: sudo apt install -y libusb-1.0-0-dev libudev-dev
+      - uses: pnpm/action-setup@v4
+        name: Install pnpm
+        with:
+          run_install: true
       - uses: pre-commit/action@v3.0.0

+ 5 - 0
.pre-commit-config.yaml

@@ -25,6 +25,11 @@ repos:
           )
   - repo: local
     hooks:
+      - id: turbo-fix
+        name: Run turbo fix on packages changed since the last commit
+        language: system
+        entry: sh -c 'TURBO_SCM_BASE="HEAD^1" pnpm turbo fix --affected'
+        pass_filenames: false
       # Hooks for the remote executor
       - id: cargo-fmt-remote-executor
         name: Cargo format for remote executor