From a17255e6b43d04a87c31d832874bdf8ef5591d00 Mon Sep 17 00:00:00 2001 From: anonpenguin23 Date: Mon, 3 Nov 2025 07:24:06 +0200 Subject: [PATCH] chore: automate changelog and version commit in pre-push hook - Enhanced the pre-push hook to automatically stage and commit changes to CHANGELOG.md and Makefile, streamlining the version update process. - Added error handling to ensure the push proceeds even if the commit fails due to no changes. --- .githooks/pre-push | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.githooks/pre-push b/.githooks/pre-push index 329b572..713770d 100644 --- a/.githooks/pre-push +++ b/.githooks/pre-push @@ -57,6 +57,18 @@ if [ -f "$CHANGELOG_SCRIPT" ]; then fi echo -e "${GREEN}Proceeding with push...${NOCOLOR}" + + # Commit the updated CHANGELOG.md and Makefile + echo -e "${CYAN}Staging CHANGELOG.md and Makefile...${NOCOLOR}" + git add CHANGELOG.md Makefile + + echo -e "${CYAN}Committing changes...${NOCOLOR}" + NEW_VERSION=$(cat "$VERSION_FILE") + git commit -m "chore: update changelog and version to $NEW_VERSION" || { + # If commit fails (e.g., no changes to commit), continue anyway + echo -e "${YELLOW}Note: Could not commit changes (may already be committed)${NOCOLOR}" + } + # Clean up temp files rm -f "$PREVIEW_FILE" "$VERSION_FILE" fi