Automation - Smart Values - GitHub Pull request merged

Sean Briceland March 22, 2021

Our team is trying to setup automation triggers for Pull Request merges into specific branches.

 

Some Context:

- We're using GitHub for our code repo.

- GitHub integration is setup and connected properly

 

For this particular Automation question We're using:

- When: "Pull request merged"

- Condition: "Advanced Compare Condition"

- Then: "Transition the issue to

 

The issue is in the "Advanced Compare Condition". Our condition is checking if {{pullRequest.destinationBranch}} equals develop.

- Our guess is that the smart value {{pullRequest.destinationBranch}} is not yielding a result (or not our expected result).

 

That should be the right syntax according to the documentation here: https://support.atlassian.com/jira-software-cloud/docs/smart-values-development/

 

Possible issues: 

- This is not supported for GitHub integrations. However, can't find any documentation on this

- We need to use the nested syntax {{pullRequest.destinationBranch.name}} as loosely implied by the link here: https://support.atlassian.com/jira-software-cloud/docs/smart-values-development/#Smartvalues-development-branch

 

If anyone else out there using JIRA + GitHub + Automation rules has some advice that be greatly appreciated!

2 answers

1 accepted

1 vote
Answer accepted
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 24, 2021

Hi Sean,

I think I see what you are trying to do here.  So I tried to setup my own Jira Cloud site using the Github for Jira integration and then try to setup the same automation rule in my own environment.

In my case, I was creating a new pull request that created a new branch called develop.  And from there I was then merging that pull request into the master branch.  Perhaps I have this part backwards from the way you are doing it.  But to getting a better insight into what is being held by that particular smart value of {{pullRequest.destinationBranch}} I decided to tweak my automation rule a bit.  

Before the condition I created a new action to post a comment that just echoed the source and destination branches so I can see what values they do have, like so:

Screen Shot 2021-03-24 at 1.13.09 PM.png

and the result I got was this comment (the issue did not transition):

Screen Shot 2021-03-24 at 1.13.31 PM.png

As you can see the destination branch in my case always seems to be using the URL instead of the name here.  Honestly, I'm not sure exactly why that is yet.  The source branch accurately reflected the expected smart values here (github renamed this branch from develop to develop-2 because I had another branch by that name while testing this).

Try testing out your own automation rule with a similar method to see the smart value's contents.  Perhaps this way you can then tweak the rule to look for the URL values instead.

Let me know if this helps.

Andy

Sean Briceland March 25, 2021

@Andy Heinzer That's a fantastic idea for debugging the values! Can't thank you enough. Looks like at the very least i should be able to use a regular expression to test that the destination branch URL includes the expected branch name.

Like Andy Heinzer likes this
Jameel Al-Aziz
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 23, 2021

Just tried and I'm also getting URLs for Github.

 

Seems like this should be documented or fixed as it's very confusing.

Jamie Evans
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 29, 2021

Hey @Andy Heinzer, do you have any update on this? I can see Kevin's response, but we're using Github (not enterprise), which should be supported, and I'm still getting the following (when I log the following to an email):

Destination
Raw Name: https://github.com/CompanyName/repo-path/tree/release/0.1.0
Raw URL:
Raw Repo: MyPerch/perch-monolith

Source
Raw Name: feature/PRCHE-195-test-jira-automation-workflow
Raw URL: https://github.com/CompanyName/repo-path/tree/feature/PRCHE-195-test-jira-automation-workflow
Raw Repo:

It seems strange that the sourceBranch works, but destination branch is so weirdly swapped around.

0 votes
Kevin Bui
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 24, 2021

Hi @Sean Briceland

Would you happen to be using GitHub Enterprise? The automation devops triggers (including Pull request merged) can't be used with GitHub Enterprise, so if this is the case the {{pullRequest.destinationBranch.name}} won't return anything.

You can find the list of compatible tools on the Automation triggers page, here.

Hope that helps!

Sean Briceland March 24, 2021

Thanks for the response @Kevin Bui . Unfortunately we are not using GitHub enterprise. 

Also we have tried both:

  • {{pullRequest.destinationBranch}}
  • {{pullRequest.destinationBranch.name}}

 

Neither seem to be returning the expected branch name value. The only thing we have to go off of is the audit log.

The log does show automation rule is triggered property when a pull request is merged.

However, it says the compare condition was not met.

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