Skip to content

Integrate gitStream with Asana

Learn how to integrate gitStream with Asana

Label Missing Asana Info

Automatically label PRs that are missing references to Asana resources.

Label Missing Asana

Configuration Description

Conditions (all must be true):

  • The PR is missing an Asana ticket reference in the PR title and a link to an Asana resource in the PR description.

Automation Actions:

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

Label Missing Asana

# -*- mode: yaml -*-

manifest:
  version: 1.0

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

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

colors:
  red: 'b60205'

Provide automatic links to Asana cards that are associated with PRs.

Automatically Link to the Related Asana Card

Configuration Description

Conditions (all must be true):

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

Automation Actions:

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

Automatically Link to the Related Asana Card

# -*- mode: yaml -*-

manifest:
  version: 1.0

provider: asana

# Configure this to match your organization. It is used in tracker.asana.baseurl.
asanaProject: 1234

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

automations:
  link_asana:
    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:
  asana:
    baseurl: https://app.asana.com/0/[asanaProject]/0/
    pattern: r/asana-(\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.