Files
sentio/scripts/install-git-hooks.sh
T
Jens Nylander c9d90af384 ci: one run per change instead of three
CI triggered on both push to any branch and pull_request, so every branch
ran twice and main ran again after merge. Push is limited to main now, and
a concurrency group cancels superseded runs. publish gets a group too, but
never cancels - a half-published release leaves a manifest without its
binaries.

Adds a pre-push hook installer for fmt and clippy.
2026-08-24 21:28:37 +02:00

25 lines
641 B
Bash
Executable File

#!/usr/bin/env bash
# Installs a pre-push hook that runs the two checks CI fails on most often.
# Catching them here costs seconds; catching them on a runner costs minutes and
# a red mark on the branch.
#
# ./scripts/install-git-hooks.sh
#
# Skip it for one push with `git push --no-verify`.
set -euo pipefail
root="$(git rev-parse --show-toplevel)"
hook="$root/.git/hooks/pre-push"
cat > "$hook" <<'HOOK'
#!/usr/bin/env bash
set -euo pipefail
echo "pre-push: cargo fmt --check"
cargo fmt --all -- --check
echo "pre-push: cargo clippy"
cargo clippy --workspace --all-targets -- -D warnings
HOOK
chmod +x "$hook"
echo "installed $hook"