CircleCI-Public / jira-orb

Connect your CircleCI pipelines to Jira.
https://circleci.com/docs/jira-plugin/
MIT License
2 stars 14 forks source link

Failure when merging branch with many commits addressing multiple Jira tickets #37

Open rafalotufo opened 9 months ago

rafalotufo commented 9 months ago

The orb uses git show -s --format='%s' \"${JIRA_DEBUG_TEST_COMMIT:-$CIRCLE_SHA1}\") to find the jira tickets related to a deployment. This fails when the last commit is a merge, since the commit title is something like "Merge pull request #734 from [branch-name]" and does not contain the list of Jira tickets included in the merge.

It seems that a simple solution to this issue is to change the git show command to something like git show -s --format='%s' \"${CIRCLE_SHA1^..$CIRCLE_SHA1}\"). This will include all of the commits included in the merge.

Thank you for addressing this issue.

mattrabe commented 9 months ago

I can confirm that the following works:

COMMIT_MESSAGE=$(git show -s --format='%s' "${CIRCLE_SHA1}^..${CIRCLE_SHA1}")

Will open a PR tomorrow, along with a temp orb.

rafalotufo commented 9 months ago

Awesome, thanks for working on this. It's going to make this orb so much more useful!

mattrabe commented 9 months ago

PR opened. In the meantime, I have published a fork that includes this change - fpcs/jira@2.0.3: https://circleci.com/developer/orbs/orb/fpcs/jira

It is forked off the v2.0.2, so does not include the changes in v2.1.0

mattrabe commented 8 months ago

I have published v2.1.1 of my fork, which includes all of v2.1.0, plus the fix for this ticket: https://circleci.com/developer/orbs/orb/fpcs/jira