Skip to content

fix: changelog release commit search logic #530

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 15, 2023
Merged
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
14 changes: 6 additions & 8 deletions semantic_release/history/logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,12 @@ def generate_changelog(
changes: dict = {"breaking": []}

found_the_release = to_version is None
to_version_commit = to_version and get_formatted_commit(to_version)
from_version_commit = from_version and get_formatted_commit(from_version)
to_version_commit = to_version and get_formatted_commit(to_version).strip()
from_version_commit = from_version and get_formatted_commit(from_version).strip()
for _hash, commit_message in get_commit_log(from_version, to_version):
# See https://github.com/relekang/python-semantic-release/issues/490 -
# commit messages (which we compare with ==) have a trailing newline
commit_message = commit_message.strip()
if not found_the_release:
# Skip until we find the last commit in this release
# (we are looping in the order of newest -> oldest)
Expand All @@ -115,12 +118,7 @@ def generate_changelog(
)
found_the_release = True

# See https://github.com/relekang/python-semantic-release/issues/490 -
# commit messages (which we compare with ==) have a trailing newline
if (
from_version_commit
and commit_message.strip() == from_version_commit.strip()
):
if (from_version_commit and commit_message == from_version_commit):
# We reached the previous release
logger.debug(f"{from_version} reached, ending changelog generation")
break
Expand Down