thiagowfx's avatar

¬ just serendipity 🍀 (not just serendipity)

prek 0.5: auto-update → update

• 240 words • 2 min

Previously.

Problem statement: prek 0.5 removed prek auto-update, which broke every scheduled updater (github workflows) we have.

The workflow installed the latest stable release. One week it resolved 0.4.14:

text
Resolved "latest" to latest stable release 0.4.14
Using prek 0.4.14
Run prek auto-update --freeze --cooldown-days 7 --jobs "$(nproc)"

The next week it resolved 0.5.0 and stopped before updating any hook:

text
Resolved "latest" to latest stable release 0.5.0
Using prek 0.5.0
Run prek auto-update --freeze --cooldown-days 7 --jobs "$(nproc)"
error: unexpected argument '--freeze' found

  tip: to pass '--freeze' as a value, use '-- --freeze'

Usage: prek <HOOK|PROJECT>...

Error: Process completed with exit code 2.

The 0.5.0 release notes listed the breaking change:

prek auto-update has been removed. Use prek update, or prek autoupdate for drop-in compatibility with pre-commit.

I switched to the canonical command in workflows and docs:

diff
-      - name: Run prek auto-update
-        run: prek auto-update --freeze --jobs "$(nproc)"
+      - name: Run prek update
+        run: prek update --freeze --jobs "$(nproc)"

Five of my personal repositories had the old comman:

text
check-json-schema-meta   9bf47ea fix(ci): use prek update command
pancake                  08e7540 fix(ci): use prek update command
perrotta.dev             a9766c9931 fix(ci): use prek update command
pre-commit-hooks         965f3ff fix(ci): use prek update command
skills                   9d81d26 fix(ci): use prek update command

The new command accepted the same options and completed a dry-run:

shell
% prek update --freeze --jobs 1 --dry-run
https://github.com/google/keep-sorted
  would update rev `339d935575ef7d92f2c9b4df9ce4b724d73c9201` (frozen: v0.9.1) -> `b225c42a9a8f480d760cf967d1e3a839060b242c` (frozen: v0.10.0)