JTurk JTurk - 1 year ago 115
Git Question

Git hook: once a branch is merged into master - update JIRA status

I am new to writing git hooks.
Here's what I'd like to do:

Once a branch XYZ is merged into master (on remote); write a hook that changes the status of a JIRA ticket associated with branch XYZ from "pending approval" to "prod ready".

My research into this so far:

  1. I've figured JIRA Rest API can allow me to do this (using

    transaction +
    OAuth API

  2. Git hooks can be written in many languages
    (and I figured python would be the easiest for me as I am well
    versed in it) .

  3. I should be implementing either
    git hook to do this. The hook would essentially get the
    Branch name (my branch name is enforced to be the same as Jira name)
    ; and then do a POST using JIRA API to change the status as
    mentioned above.

  4. There is such a thing as "web hooks" that are also
    an option for folks using github. My repo at the moment is github
    deployed into the organization..but we might be moving toward
    bitbucket; in which case I am concerned that webhooks will no longer be useful...

My questions:

  1. Is it possible to accomplish this task?

  2. If so, what githook should I
    be using?

  3. Should I be using web hooks or

  4. Can anyone point me to an example to get me started?


Answer Source

Found the answer ...Here's how to do it - for those interested:


  • Esssentially, Jira has a "workflow" section; in which you can create a "trigger".
  • The trigger can be activated to perform a "transition"...which is to say the status of the JIRA can be changed using this trigger.
  • Its all UI driven; so you don't have to script a githook or a
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download