1
0
Fork 0
mirror of https://github.com/imjasonh/apidiff-action synced 2026-07-06 22:52:43 +00:00
apidiff-action/scripts/pre-commit-check-dist.sh
Jason Hall c8230cc936
fix: make pre-commit scripts work in CI without nvm
- Check if already on Node 20 before trying to use nvm
- This fixes CI where nvm is not available but Node 20 is already set
2025-07-30 09:35:56 -04:00

15 lines
400 B
Bash
Executable file

#!/bin/bash
# Pre-commit script to check if dist is up to date
# Try to use Node 20 via nvm if available
export NVM_DIR="$HOME/.nvm"
if [ -s "$NVM_DIR/nvm.sh" ]; then
. "$NVM_DIR/nvm.sh"
nvm use 20.9.0 >/dev/null 2>&1
fi
# Check if dist has uncommitted changes
if [ -n "$(git status --porcelain dist)" ]; then
echo "dist is out of date. Run npm run build and commit the changes."
exit 1
fi