Skip to content

Integrate gitStream with Shortcut

Learn how to integrate gitStream with Shortcut

Label Missing Shortcut Info

Automatically label PRs that are missing references to Shortcut resources.

Label Missing Shortcut

Configuration Description

Conditions (all must be true):

  • The PR is missing one of the following:
    • An Shortcut ticket reference in the PR title.
    • A link to an Shortcut resource in the PR description.

Automation Actions:

  • Apply a red ⚠️ Missing Shortcut Link label
  • Post a comment that asks the author to add an Shortcut reference to the PR.

Label Missing Shortcut

# -*- mode: yaml -*-

manifest:
  version: 1.0

automations:
  label_missing_shortcut:
    if:
      - {{not (has.shortcut.ticket_in_title or has.shortcut.ticket_in_desc)}}
    run:
      - action: add-label@v1
        args:
          label: "⚠️ Missing Shortcut Link"
          color: {{ colors.red }}
      - action: add-comment@v1
        args:
          comment: Please provide a link to the associated Shortcut resource.

has:
  shortcut:
    ticket_in_title: {{ pr.title | includes(regex=r/(\w+)\/sc-(\d+)/) }}
    ticket_in_desc: {{ pr.description | includes(regex=r/(app\.shortcut\.com)\/(\w+)\/story\/(\d+)\/(\w+)/) }}

colors:
  red: 'b60205'

Provide automatic links to Shortcut tasks that are associated with PRs.

Automatically Link to the Related Shortcut Task

Configuration Description

Conditions (all must be true):

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

Automation Actions:

  • Post a comment that provides a link to the associated Shortcut Task.

Automatically Link to the Related Shortcut Task

# -*- mode: yaml -*-

manifest:
  version: 1.0

# Configure these to match your organization.
provider: jira

# Change this to match the name of your Shortcut organization. This is used in tracker.shortcut.baseurl
orgName: org

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

automations:
  link_shortcut:
    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:
  shortcut:
    baseurl: https://app.shortcut.com/[orgName]/story/
    pattern: r/(\w+)\/sc-(\d+)/

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.