Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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

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!

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

TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you