Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Issues with specific commits & transition them

Mike
Contributor
June 6, 2020

Here's my use case: I want to automatically move issues from "Review" to "Pending Deploy" when the final PR from our staging branch to master is merged.

I set up an automation to trigger on PR merge and filter for the consistent name we use for the staging => master PR, then move issues associated to that PR from "Review" to "Pending Deploy."

However, I found out that JIRA really only tracks the first PR for a given commit associated to an issue. Since there's always a prior PR from a develop branch to our staging branch, that's the only one associated to a given issue...despite the fact that the associated commits are part of the later PR from staging to master.

Thus, my automation didn't work. Then, my idea was to have the same trigger, but send a webhook to externally query for all issues related to the commits in the PR. However, that's where I got stuck. I can't seem to query for issues related to a specific commit, only issues with some aggregated count of commits (development[commits].all).

I also tried checking the Bitbucket Cloud API to see if I could retrieve the JIRA issues related to the PR...haven't found anything documented that allows me to do that.

So...now I'm left what I think are the only 2 workarounds:

<== A ==>
1. Automation trigger on Commit created
2. Set/update an issue property to store/append the {{commit.hash}}
3. Send webhook when PR is merged with matching name
4. Query Bitbucket for all commits included in the PR
5. Query JIRA for all issues whose property contains one of the associated commits
6. Use the JIRA Cloud REST API to transition the qualifying issues

<== B ==>
1. Send webhook when PR is merged with matching name
2. Query Bitbucket for all commits included in the PR
3. Query JIRA for all issues in the "Review" status (plus other relevant filters)
4. Use an undocumented API to retrieve all commits associated to these issues
5. Collect all issues whose commits contain those included in the PR
6. Use the JIRA Cloud REST API to transition the qualifying issues

This seems...a bit much. Am I missing something obvious?

0 answers

Suggest an answer

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

Atlassian Community Events