Skip to content

Commit 385d2fc

Browse files
committed
fix issue of duplicate change-log entries
1 parent 41bb6ad commit 385d2fc

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

actions/release/github/action.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,15 @@ runs:
283283
echo "Working directory: $WORK_DIR"
284284
cd "$WORK_DIR"
285285
286+
# Read changelog_file from commitizen config (needed for recovery path)
287+
CHANGELOG_FILE=""
288+
if [ -f "pyproject.toml" ]; then
289+
CHANGELOG_FILE=$(grep -A 20 "^\[tool\.commitizen\]" pyproject.toml | grep "^changelog_file" | head -1 | sed 's/.*=\s*"\(.*\)"/\1/' || true)
290+
fi
291+
if [ -z "$CHANGELOG_FILE" ]; then
292+
CHANGELOG_FILE="CHANGELOG.md"
293+
fi
294+
286295
echo "::group::Getting current version"
287296
CURRENT_VERSION=$($CZ_CMD version --project)
288297
echo "✓ Current version: $CURRENT_VERSION"
@@ -321,7 +330,10 @@ runs:
321330
# If bump failed, recover by generating full changelog and retrying with --files-only
322331
if [ $BUMP_EXIT_CODE -ne 0 ]; then
323332
echo "⚠ cz bump encountered an issue (exit code: $BUMP_EXIT_CODE)"
324-
echo "Recovering: generating full changelog and retrying..."
333+
echo "Recovering: resetting changelog and regenerating..."
334+
335+
# Reset changelog to pre-bump state to avoid duplicate entries
336+
git checkout -- "$CHANGELOG_FILE"
325337
326338
# Generate full changelog
327339
$CZ_CMD changelog --unreleased-version="$NEXT_VERSION"

0 commit comments

Comments
 (0)