Github smart commits transition workflows when not using default branch

Wyatt Mufson November 17, 2020

How do you get the smart commits to only transition workflows on the default branch? Currently when we push smart commits to a non-default branch is transitions the workflow. This seems like I must be missing something obvious.

1 answer

0 votes
Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 19, 2020

Hello @Wyatt Mufson ,

Welcome to the Atlassian Community!

As outlined in the Process issues with smart commits documentation page, in order to transition an issue using smart commits you need to enter something like below text in the commit message:

<ignored text> <ISSUE_KEY> <ignored text> #<transition_name> #comment <comment_string>

The above commit message will make the issue having ISSUE_KEY transition to transition_name.

So, I believe what is happening in your case instead is that you have a workflow trigger that is making your issues transition on some specific conditions (e.g. commit created). 

Can you kindly check if this is the case?

 

For further details:

 

Cheers,
Dario

Wyatt Mufson November 19, 2020

When the commit message <ISSUE_KEY> #resolve is committed to any branch, it transitions the issue to resolved. What we need is for this to happen only if the commit being committed to the default branch (i.e. master). With the current behavior it closes the issue before a pull request is reviewed.

Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 20, 2020

Hi @Wyatt Mufson ,

I might be missing/misunderstanding something, but this seems to be the expected behavior: if in a commit message you explicitly tell to Jira to resolve an issue then Jira will transition that issue to resolved status.

Can you share a bit more details on what you are trying to achieve since there might be another way to get to the same results? 

 

Cheers,
Dario

Wyatt Mufson November 20, 2020

We want Jira issues to close when the code that resolves it is merged into the default branch and not just any branch. Since this does not seem to be an out of the box feature of Jira we've decided to use a different product.

Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 24, 2020

@Wyatt Mufson , 

Please notice nobody said it cannot be done in Jira, it was just mentioned that there is another/different way to do it.

Specifically: if you only want to close the issue when the code is merged into master, then you should either use a  workflow trigger  or an automation rule on the "pull-request merged" event.

For more details see also the below thread:

https://community.atlassian.com/t5/Jira-Software-questions/Transition-issue-when-pull-request-is-merged-on-a-specific/qaq-p/1028581

 

Cheers,
Dario

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events