apt-ostree/scripts/commit-with-changelog.sh
apt-ostree-dev e1d682f6a8
Some checks failed
Comprehensive CI/CD Pipeline / Build and Test (push) Successful in 6m19s
Comprehensive CI/CD Pipeline / Security Audit (push) Failing after 6s
Comprehensive CI/CD Pipeline / Package Validation (push) Successful in 37s
Comprehensive CI/CD Pipeline / Status Report (push) Has been skipped
updated post commit to stop infinite loop
---
Session Changes:

Add your changes here during development...
2025-08-21 17:17:58 -07:00

64 lines
1.6 KiB
Bash
Executable file

#!/bin/bash
# Script to manually commit with changelog content
# This avoids the complexity and risks of git hooks
set -e
echo "🔄 Manual commit with changelog..."
# Check if CHANGELOG.md exists and has content
if [ ! -f "CHANGELOG.md" ] || [ ! -s "CHANGELOG.md" ]; then
echo "❌ No CHANGELOG.md content found. Please add your changes first."
exit 1
fi
# Check if there are staged changes
if [ -z "$(git diff --cached --name-only)" ]; then
echo "❌ No staged changes found. Please stage your changes first with 'git add'."
exit 1
fi
# Create a temporary file for the commit message
TEMP_MSG=$(mktemp)
# Get the commit message from user input
echo "Enter your commit message (or press Enter for default):"
read -r user_message
if [ -z "$user_message" ]; then
user_message="Update"
fi
echo "$user_message" > "$TEMP_MSG"
# Add a separator
echo "" >> "$TEMP_MSG"
echo "---" >> "$TEMP_MSG"
echo "Session Changes:" >> "$TEMP_MSG"
echo "" >> "$TEMP_MSG"
# Add the CHANGELOG.md content (excluding the header)
grep -v "^#" CHANGELOG.md | grep -v "^$" >> "$TEMP_MSG"
# Commit with the combined message
git commit -F "$TEMP_MSG"
# Clean up temp file
rm "$TEMP_MSG"
echo "✅ Commit completed with changelog content"
# Clear the CHANGELOG.md file
echo "# apt-ostree Changelog" > CHANGELOG.md
echo "" >> CHANGELOG.md
echo "## Current Session Changes" >> CHANGELOG.md
echo "" >> CHANGELOG.md
echo "Add your changes here during development..." >> CHANGELOG.md
# Stage and commit the cleared changelog
git add CHANGELOG.md
git commit -m "chore: clear changelog for next session"
echo "🧹 CHANGELOG.md cleared for next session"
echo "✅ All done!"