diff --git a/.github/workflows/hotfix-branch-creation.yml b/.github/workflows/hotfix-branch-creation.yml index 9b0cbe76..adcfbad6 100644 --- a/.github/workflows/hotfix-branch-creation.yml +++ b/.github/workflows/hotfix-branch-creation.yml @@ -162,24 +162,32 @@ jobs: if [ -f "$CHANGELOG_PATH" ]; then DATE=$(date +%Y-%m-%d) - # Create hotfix entry - HOTFIX_ENTRY="## [${HOTFIX_VERSION}] - ${DATE} - HOTFIX + # Create hotfix entry using cat with heredoc + cat > /tmp/hotfix_entry.md << 'EOF' +## [${HOTFIX_VERSION}] - ${DATE} - HOTFIX ### Fixed - ${ISSUE} --- -" +EOF - # Insert after the first line (title) using a temp file + # Replace variables in the temp file + sed -i.bak "s/\${HOTFIX_VERSION}/${HOTFIX_VERSION}/g" /tmp/hotfix_entry.md + sed -i.bak "s/\${DATE}/${DATE}/g" /tmp/hotfix_entry.md + sed -i.bak "s/\${ISSUE}/${ISSUE}/g" /tmp/hotfix_entry.md + + # Insert after the first line (title) TITLE=$(head -n 1 "$CHANGELOG_PATH") BODY=$(tail -n +2 "$CHANGELOG_PATH") echo "$TITLE" > "$CHANGELOG_PATH" echo "" >> "$CHANGELOG_PATH" - echo "$HOTFIX_ENTRY" >> "$CHANGELOG_PATH" + cat /tmp/hotfix_entry.md >> "$CHANGELOG_PATH" echo "$BODY" >> "$CHANGELOG_PATH" + rm -f /tmp/hotfix_entry.md /tmp/hotfix_entry.md.bak + echo "✅ Added CHANGELOG entry for hotfix $HOTFIX_VERSION" else echo "⚠️ Warning: $CHANGELOG_PATH not found"