From bce971fbd262f0de73a1330f921060ec12939907 Mon Sep 17 00:00:00 2001 From: Weaselbot Date: Tue, 27 Oct 2026 18:53:07 -0400 Subject: [PATCH] ci: don't hardcode ~/.local/bin when running pre-commit The pre-commit job failed with /root/.local/bin/pre-commit: No such file or directory even though `pipx install pre-commit` succeeded: `pipx install` writes the app to PIPX_BIN_DIR, and the runner image no longer uses ~/.local/bin for it. Run the binary from PATH when pipx put it there, and fall back to `pipx run pre-commit` otherwise, so the hook still runs regardless of where pipx exposes its apps. --- .gitea/workflows/ci.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 4728c17..194c672 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -12,7 +12,15 @@ jobs: run: pipx install pre-commit - name: Run pre-commit - run: ~/.local/bin/pre-commit run --all-files --show-diff-on-failure + # `pipx install` writes the app to PIPX_BIN_DIR, which is not + # necessarily ~/.local/bin and not necessarily on PATH, so don't + # hardcode a path that only some runner images happen to use. + run: | + if command -v pre-commit >/dev/null 2>&1; then + pre-commit run --all-files --show-diff-on-failure + else + pipx run pre-commit run --all-files --show-diff-on-failure + fi build: strategy: