Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How can I get at 'development' information associated with an issue with jira-python?

Dong Ming May 29, 2015

My team set up our workflow so JIRA tickets get automatically transitioned with Github: https://answers.atlassian.com/questions/156678.  My scenario is that I want to automate (using jira-python) updating specific fields based on the 'development' information (i.e. if there were commits, pull requests or merged pull requests.. etc) for the tickets.

 

My specific questions are:

1) How can I query to find these issues?  

2) How can I retrieve the development info associated with an issue (commits, PRs, merges, branch names used.. etc)

Thanks!

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Dylan Williams September 22, 2015

This is not currently supported in the python JIRA module. To get this information, you'll have to do some hacky stuff. I did the following to get Pull Requests.

I hijacked the session from the module:

sess_get = jira._session.get

Then I crafted my own request for the particular detail I was trying to get at, in this case pull requests.

The best way to figure out what the API endpoint URI looks like is to open the javascript console (in chrome), then click the network tab, then click the box for 'Preserve Log'. After that, click the link for the element you want to find. In the left hand side of the network box, you'll see a bunch of entries populated, click through them until you find the one that contains your data (found in the response). From here, you'll craft your request:

DEV_STATUS = 'https://myorg.atlassian.net/rest/dev-status/1.0'
_issue = 'issue/detail?issueID=%s' % issue.id
_args = 'applicationType=github&dataType=pullrequest&_=%s' % int(time.time())
req_url = '%s/%s&%s' % (DEV_STATUS, _issue, _args)
response = sess_get(req_url)
raw_data = json.loads(response.content)
 
for req in raw_data['detail'][0]['pullRequests']:
    print('%s\n%s\n\n' % (req['name'], req['url']))

I hope that helps!

Josh Brown October 26, 2016

You rule.

Kaushik Veluru
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 6, 2019

@Dylan Williams You are a rockstar. Thanks so much for this answer. 

TAGS
AUG Leaders

Atlassian Community Events