Skip to content

fix: search for release commit with commit_subject - #488

Merged
danth merged 3 commits into
python-semantic-release:masterfrom
d-ryzhykau:fix/release-commit-search-pattern
Aug 22, 2022
Merged

danth merged 3 commits into
python-semantic-release:masterfrom
d-ryzhykau:fix/release-commit-search-pattern

Conversation

@d-ryzhykau

@d-ryzhykau d-ryzhykau commented Aug 13, 2022 •

Copy link
Copy Markdown
Contributor

Use release commit template settings in release commit search.

Use commit_subject template in release commit search.
@bernardcooke53

Copy link
Copy Markdown
Contributor

@d-ryzhikov this looks like a good catch! Since we don't want to identify the current version with a commit that doesn't match the specified commit_subject, is it worth adding an explicit test that a commit in the log which doesn't match the commit_subject template but contains the current version returns None?

Add test to check that commits containing current version
but not matching commit_subject pattern are ignored.
@d-ryzhykau

Copy link
Copy Markdown
Contributor Author

@bernardcooke53 I've added a test for a case when there is a commit with a message containing current version but the subject doesn't match commit_subject setting. However, in this case evaluate_version_bump shouldn't return None. Instead it should not evaluate this commit as the release commit and continue the search.

@bernardcooke53

Copy link
Copy Markdown
Contributor

@d-ryzhikov looks good! Yes you're right about the bump, in my head I was thinking of an out-of-scope commit not triggering a bump - the way you've done it is good too 🙂

@d-ryzhykau

Copy link
Copy Markdown
Contributor Author

I updated the release commit search logic in evaluate_version_bump and in generate_changelog. Now the release commit check is more strict: a commit message for a target version is constructed and only commits with exactly matching messages are considered to be target version commits.

@danth danth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break if the commit_subject is reconfigured - but I think it's an improvement over the current behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants