Post

JIRA and GITHUB Actions integration

JIRA-GITHUB Integration ๐Ÿ”—

Seamlessly integrate JIRA with GitHub using our ๐Ÿ”— integration.

Overview ๐Ÿ“

This project demonstrates a straightforward method to integrate JIRA with GitHub. Any changes made to a JIRA ticket, such as transitioning its status, will automatically trigger GitHub actions.

Features โœจ

  • Seamless Integration: Effortlessly connect JIRA with GitHub to streamline your workflow.
  • Automated Triggering: Automatically trigger GitHub actions in response to any changes made to a JIRA ticket.
  • Real-Time Updates: Stay up-to-date with real-time notifications in GitHub when a JIRA ticketโ€™s status is transitioned.
  • Enhanced Collaboration: Facilitate collaboration between development and project management teams by integrating JIRA and GitHub seamlessly.
  • Efficient Workflow: Simplify your workflow by automating processes and reducing manual interventions between JIRA and GitHub.

Setup Instructions ๐Ÿšง

  • Create PAT token under GITHUB account Goto Profile โ€“> Developer settings โ€“> PAT (with workflow access) and copy the PAT token and store it securely for now. alt text alt text
  • Now letโ€™s create the JIRA automation (Requires access to project automation) Goto JIRA project โ€“> settings โ€“> Automation โ€“> Click create Rule (letโ€™s choose when issue is transitioned from in-progress to Done) alt text alt text
  • Add the action as send web request. alt text alt text
  • Configure the web request URL, the format of the github repository to invoke the workflow is below:
    1
    
    https://api.github.com/repos/[github-user]/[REPO]/actions/workflows/[WORKFLOW_ID]/dispatches
    
    • How to get the WORKFLOW_ID? hit the below URL in browser and you will get the workflow id
      1
      
      https://api.github.com/repos/[github-user]/[REPO]/actions/workflows
      

      alt text alt text

  • Configure the other settings of the JIRA Automation:
    • Set HTTP Method as POST
    • Web Request body as Custom with the following content (i.e. we are sending JIRA key number to the GITHUB request as my git repo workflow expects input)

      1
      2
      3
      4
      5
      6
      
        {
        "ref":"main",
        "inputs":{
            "issue_key": "{{ issue.key }}"
            }
        }
      
    • Configure the headers section:

      keyvalueHidden
      AuthorizationBearer ยซPAT FROM GITHUBยปโœ…
      Acceptapplication/vnd.github+jsonย 
      X-GitHub-Api-Version2022-11-28ย 
    • You can test validate by clicking on validate button, however you will need to set the โ€œissue_keyโ€ to some hardcoded value, as you are manually triggering the automation.

      1
      
        "issue_key": "TEST"
      

      you should see status code as 204

      Remember to revert the issue_key, so that actual JIRA key is sent to GITHUB instead of test.

    • Save the automation

Testing ๐Ÿงช

  • Now letโ€™s try to check if our automation is working as expected.
  • Create a ticket and move the ticket from in-progress status to Done. alt text alt text
  • This will trigger GITHUB-ACTIONS, go to the actions tab to verify. alt text alt text
  • The JIRA ticket is present in the GITHUB logs as it was printed alt text alt text

    Resources ๐Ÿ“š

  • GTHUB PAT AUTHENTICATION

  • GITHUB DISPATCH

Git repo ๐Ÿ“

REPO

Happy coding! ๐ŸŽ‰

This post is licensed under CC BY 4.0 by the author.