DroidsOnRoids / bitrise_step_build_info_jira_comment

MIT License
2 stars 7 forks source link

chore: use raw commit message in last_commit lookup #4

Closed tcank closed 3 years ago

tcank commented 3 years ago

The use of %b only extract the body of the commit message. When a commit only has one line, the last commit is always empty, because the message only has a subject. Using %B we can match the issue ID all along the message. In our team, we apply the Conventional Commits Specification, where the use of body in a commit message is optional. Almost all of our regular commit messages are one line and the step is not compatible with them.

You can reproduce the issue making a commit like git commit -m "fix(AR-252): my description of the changes"

And then run the same command that is used to extract last commit LAST_COMMIT=$(git log -1 --pretty=format:%b)

LAST_COMMIT will be empty. If we change the %b to %B we can catch this kind of cases, and we are still compatible with the rest of the commits that have subject and body.

Pretty formats docs: https://git-scm.com/docs/pretty-formats