Update pre-push hook to auto-commit and push generated PDFs

This commit is contained in:
Colin 2025-12-02 13:15:15 -05:00
parent 70085f5258
commit cb409efb34
Signed by: colin
SSH Key Fingerprint: SHA256:nRPCQTeMFLdGytxRQmPVK9VXY3/ePKQ5lGRyJhT5DY8
25 changed files with 22 additions and 2 deletions

Binary file not shown.

Binary file not shown.

View File

@ -2,6 +2,9 @@
# Pre-push hook to generate PDFs before pushing
# This ensures PDFs are always up to date when code is pushed
# Capture remote from arguments
REMOTE="$1"
# Don't exit on error immediately - we want to report issues but not break the push
set +e
@ -83,7 +86,25 @@ if PUPPETEER_EXECUTABLE_PATH="$CHROME_PATH" npm run generate-pdfs; then
# Check if there are changes staged
if ! git diff --cached --quiet --exit-code "$PDFS_DIR" 2>/dev/null; then
echo "✓ PDFs updated and staged for commit"
echo "✓ PDFs updated. Committing changes..."
# Commit the changes
if git commit -m "Auto-update generated PDFs" --no-verify; then
echo "✓ Changes committed. Restarting push..."
# Push the new commit
# We use --no-verify to skip running this hook again since we just ran it
if git push "$REMOTE" --no-verify; then
echo "✓ Push successful."
exit 1 # Cancel the original push since we just pushed the new state
else
echo "✗ Failed to push updated PDFs."
exit 1
fi
else
echo "✗ Failed to commit updated PDFs."
exit 1
fi
fi
fi
fi
@ -93,4 +114,3 @@ else
fi
exit 0