Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,18 @@ Improves the changelog comparison logic to ensure more accurate change detection
### Technical Details
- Updated internal comparison logic for more reliable changelog state detection
<!-- Updated for AI processing at 2025-08-17T21:37:53.855Z -->


## [1.1.2] - August 2025

Improves the changelog comparison functionality by implementing a more accurate git diff-based approach, ensuring more reliable change detection and version tracking.

### Fixed
- Enhanced changelog comparison accuracy using git diff for more precise change detection

### Technical Details
- Implemented git diff-based comparison logic for improved changelog state tracking
- Added comprehensive test coverage for changelog comparison scenarios
<!-- Updated for AI processing at 2025-08-19T14:08:56.727Z -->

<!-- Updated for AI processing at 2025-08-19T14:08:57.564Z -->
10 changes: 2 additions & 8 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -456,20 +456,14 @@ runs:
git fetch origin "$BASE_BRANCH"

echo "Comparing with origin/$BASE_BRANCH..."
# First, get the content from the base branch
BASE_CONTENT=$(git show "origin/$BASE_BRANCH:${{ inputs.changelog_path }}" 2>/dev/null || echo "")
# Then compare with the current working file
CURRENT_CONTENT=$(cat "${{ inputs.changelog_path }}" 2>/dev/null || echo "")

if [ "$BASE_CONTENT" = "$CURRENT_CONTENT" ]; then
if git diff --quiet FETCH_HEAD -- "${{ inputs.changelog_path }}"; then
echo "has_changes=false" >> $GITHUB_OUTPUT
echo "DEBUG: No differences from base branch"
else
echo "has_changes=true" >> $GITHUB_OUTPUT
echo "DEBUG: Changelog differs from base branch"
echo "Diff preview:"
# Show the diff between base branch and working directory
git show "origin/$BASE_BRANCH:${{ inputs.changelog_path }}" | diff -u - "${{ inputs.changelog_path }}" || true
git diff FETCH_HEAD -- "${{ inputs.changelog_path }}"
fi
else
# For non-PR events, check local changes
Expand Down
50 changes: 50 additions & 0 deletions test-fix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash

# Test script to verify the changelog comparison fix

echo "Testing changelog comparison logic..."

# Create a test changelog
TEST_CHANGELOG="test-changelog.md"
echo "# Test Changelog" > $TEST_CHANGELOG
echo "" >> $TEST_CHANGELOG
echo "## [1.0.0] - January 2025" >> $TEST_CHANGELOG
echo "Initial version" >> $TEST_CHANGELOG

# Simulate base branch content
BASE_CONTENT="# Test Changelog

## [1.0.0] - January 2025
Initial version"

# Simulate current working directory content (with new changes)
CURRENT_CONTENT="# Test Changelog

## [1.0.1] - January 2025
New feature added

## [1.0.0] - January 2025
Initial version"

# Write current content to file
echo "$CURRENT_CONTENT" > $TEST_CHANGELOG

# Test the comparison logic
echo "Base content:"
echo "$BASE_CONTENT"
echo ""
echo "Current content:"
echo "$CURRENT_CONTENT"
echo ""

# Compare
if [ "$BASE_CONTENT" = "$CURRENT_CONTENT" ]; then
echo "Result: No changes detected (WRONG - this is the bug)"
else
echo "Result: Changes detected (CORRECT)"
fi

# Cleanup
rm -f $TEST_CHANGELOG

echo "Test complete!"