Forums

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

Check if JIRA ticket ID is open or closed in commit message in Github

Sunil Bansiwal May 9, 2020

I want to integrate my JIRA cloud with my Github account. Whenever I put JIRA ticket id in my commit message I want to check if that ticket id is open or closed. If the id is closed then the commit should fail. How can I do that? 

1 answer

1 vote
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 19, 2020

Hi Sunil,

I understand that you are using Jira Cloud and you want to be able to use the status of a Jira issue to automatically reject a commit from github containing that Jira issuekey.  Within Jira Cloud, I have not yet found a way to do this.  I also have not found a means in our Marketplace for a third party app that can do this either.

I tried to see if there was a way to do this with Jira Cloud's own automation, and while there are smart values for development data such as {{commit.url}}, this information by itself doesn't seem like enough to do what you want here. 

I found that automation could trigger an automation rule upon a commit, and setup a condition to check the status of the issue in Jira, but the actions available to us such as Send a Web request (aka webhook) seems like the closest I could get here.  If there was a specific webhook URL/payload that github would accept that Jira could make to reject that specific PR/commit, then perhaps you could get this to work.   However in my own testing I wasn't able to identify a specific means to do this within Github.  If you have never used automation in Jira Cloud, I'd recommend starting with Automate your Jira Cloud processes and workflows for some help playing around with this if you want to try to explore this option for yourself.

In researching this topic, I did come across a different idea to try here instead.  The concept is called 'pre-receive hook script', which seems to do what I think you want here.  There are some details about this over in https://help.github.com/en/enterprise/2.18/admin/developer-workflow/creating-a-pre-receive-hook-script I think this second option looks to be much more promising, however it seems that this is specifically for Enterprise Server version of Github.  So this might not be applicable to other platforms of Github, but I wanted to at least share with you what I found on the topic. 

I hope this helps.

Andy

Sunil Bansiwal May 21, 2020

Thanks Andy. I will look into it 

Suggest an answer

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

Atlassian Community Events