Update pre-push hook to auto-commit and push generated PDFs
This commit is contained in:
parent
70085f5258
commit
cb409efb34
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue