Skip to content

Integrate gitStream with Jira

Learn how to integrate gitStream with Jira

Label Missing Jira Info

Label PRs that don't reference a Jira ticket in the title or description. This uses regex to detect Jira ticket formats in the title (e.g. ABC-1234), and URLs to Jira tickets in the description.

Label Missing Jira

Configuration Description

Conditions (all must be true):

  • The PR lacks a Jira ticket number in the title, or a link to a Jira ticket in the PR description.

Automation Actions:

  • Apply a missing-jira label.

Label Missing Jira Info

# -*- mode: yaml -*-

manifest:
  version: 1.0

automations:
  label_missing_jira_info:
    # Triggered for PRs that don't have either a Jira ticket number in the title,
    # or a link to a Jira ticket in the PR description.
    if:
      - {{ not (has.jira_ticket_in_title or has.jira_ticket_in_desc) }}
    run:
      - action: add-label@v1
        args:
          label: "missing-jira"
          color: 'F6443B'

has:
  jira_ticket_in_title: {{ pr.title | includes(regex=r/\b[A-Za-z]+-\d+\b/) }}
  jira_ticket_in_desc: {{ pr.description | includes(regex=r/atlassian.net\/browse\/\w{1,}-\d{3,4}/) }}

Provide automatic links to Jira issues that are associated with PRs.

Automatically Link to the Related Jira Card

Configuration Description

Conditions (all must be true):

  • The PR contains a reference to an Jira card in the title or branch name.

Automation Actions:

  • Post a comment that provides a link to the associated Jira Card.

Automatically Link to the Related Jira Card

# -*- mode: yaml -*-

manifest:
  version: 1.0

provider: jira

# Change this to the name of your Jira organization
orgName: org

{% set ticketid = "" %}
{% for ticket in tickets %}
{% if (ticket | includes(regex=r/.+/)) %}
{% set ticketid = ticket %}
{% endif %}
{% endfor %} 

automations:
  link_jira:
    if:
      - {{ has.ticket_in_title or has.ticket_in_branch }}
    run:
      - action: add-comment@v1
        args:
          comment: Issue Tracker Link - [{{ticketid}}]({{tracker[provider].baseurl}}{{ticketid}})

has:
  ticket_in_title: {{ pr.title | includes(regex=tracker[provider].pattern) }}
  ticket_in_branch: {{ branch.name | includes(regex=tracker[provider].pattern) }}

tracker:
  jira:
    baseurl: https://[orgName].atlassian.net/browse/
    pattern: r/\b[A-Za-z]+-\d+\b/

tickets:
  - {{branch.name | capture(regex=tracker[provider].pattern)}}
  - {{pr.title | capture(regex=tracker[provider].pattern)}}

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.

Related Automations:

More Automations can be found on the Automation Library and Integrations pages.