Automatic Jira Status Updates
Automatically update the status of Jira tickets when a PR is opened.
Jira Webhook Integration Required
You need to configure an incoming Jira webhook to use this automation.
Configuration Description
Conditions (all must be true):
- A PR is created that references a Jira ticket in the title or description.
Automation Actions:
- Make an HTTP request to a Jira webhook that is pre-configured to update the ticket status.
Automatic Jira Status Updates
# -*- mode: yaml -*-
manifest:
version: 1.0
on:
- pr_created
{% set ticketid = "\b[A-Za-z]+-\d+\b" %}
{% for ticket in tickets %}
{% if (ticket | includes(regex=r/.+/)) %}
{% set ticketid = ticket %}
{% endif %}
{% endfor %}
automations:
jira_change_status:
if:
- {{ has.jira_ticket_in_title or has.jira_ticket_in_desc }}
run:
- action: send-http-request@v1
args:
url: "{{ env.JIRA_CHANGE_STATUS_WEBHOOK }}"
method: POST
headers: '{"Content-type": "application/json"}'
body: '{"issues":["{{ticketid}}"],"data":{"pr_url":"https://github.com/{{repo.owner}}/{{repo.name}}/pull/{{pr.number}}"}}'
has:
jira_ticket_in_title: {{ pr.title | includes(regex=r/\b[A-Za-z]+-\d+\b/) }}
jira_ticket_in_branch: {{ branch.name | includes(regex=r/\b[A-Za-z]+-\d+\b/) }}
tickets:
- {{branch.name | capture(regex=r/\b[A-Za-z]+-\d+\b/)}}
- {{pr.title | capture(regex=r/\b[A-Za-z]+-\d+\b/)}}
Additional Resources
gitStream is a workflow automation tool that enables you to use YAML configuration files to optimize your code review process. Add context to PRs, find code experts for reviews, and automate the merge process to maximize developer productivity.
Learn More about how gitStream Works.
More Automations can be found on the Automation Library and Integrations pages.