Some checks failed
Go Benchmark / Performance Regression Check (push) Has been cancelled
Cerberus Integration / Cerberus Security Stack Integration (push) Has been cancelled
Upload Coverage to Codecov / Backend Codecov Upload (push) Has been cancelled
Upload Coverage to Codecov / Frontend Codecov Upload (push) Has been cancelled
CodeQL - Analyze / CodeQL analysis (go) (push) Has been cancelled
CodeQL - Analyze / CodeQL analysis (javascript-typescript) (push) Has been cancelled
CrowdSec Integration / CrowdSec Bouncer Integration (push) Has been cancelled
Docker Build, Publish & Test / build-and-push (push) Has been cancelled
Quality Checks / Auth Route Protection Contract (push) Has been cancelled
Quality Checks / Codecov Trigger/Comment Parity Guard (push) Has been cancelled
Quality Checks / Backend (Go) (push) Has been cancelled
Quality Checks / Frontend (React) (push) Has been cancelled
Rate Limit integration / Rate Limiting Integration (push) Has been cancelled
Security Scan (PR) / Trivy Binary Scan (push) Has been cancelled
Supply Chain Verification (PR) / Verify Supply Chain (push) Has been cancelled
WAF integration / Coraza WAF Integration (push) Has been cancelled
Docker Build, Publish & Test / Security Scan PR Image (push) Has been cancelled
34 lines
839 B
Bash
Executable File
34 lines
839 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# pre-commit hook: ensure large files added to git are tracked by Git LFS
|
|
MAX_BYTES=$((50 * 1024 * 1024))
|
|
FAILED=0
|
|
|
|
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM)
|
|
if [ -z "$STAGED_FILES" ]; then
|
|
exit 0
|
|
fi
|
|
|
|
while read -r f; do
|
|
[ -z "$f" ] && continue
|
|
if [ -f "$f" ]; then
|
|
size=$(stat -c%s "$f")
|
|
if [ "$size" -gt "$MAX_BYTES" ]; then
|
|
# check if tracked by LFS via git check-attr
|
|
filter_attr=$(git check-attr --stdin filter <<<"$f" | awk '{print $3}' || true)
|
|
if [ "$filter_attr" != "lfs" ]; then
|
|
echo "ERROR: Large file not tracked by Git LFS: $f ($size bytes)" >&2
|
|
FAILED=1
|
|
fi
|
|
fi
|
|
fi
|
|
done <<<"$STAGED_FILES"
|
|
|
|
if [ $FAILED -ne 0 ]; then
|
|
echo "You must track large files in Git LFS. Aborting commit." >&2
|
|
exit 1
|
|
fi
|
|
|
|
exit 0
|