File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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"
You can’t perform that action at this time.
0 commit comments