Skip to content

Incorrect link with Link-JIRA Automation Rule #699

@rjop-hccgt

Description

@rjop-hccgt

Describe the bug

When using the link-jira automation rule, the link is incorrect.

To Reproduce

Steps to reproduce the behavior:

  1. The .cm automation file
manifest:
  version: 1.0

triggers:
  on:
    - pr_created
    - commit

provider: jira
orgName: <myorg>
{% set ticketid = "" %}
{% for ticket in tickets %}
{% if (ticket | includes(regex=r/.+/)) %}
{% set ticketid = ticket %}
{% endif %}
{% endfor %}
automations:
  link_jira:
    if:
      - {{ is.approved_author }}
      - {{ has.jira_ticket_in_title or has.jira_ticket_in_branch  }}
    run:
      - action: add-comment@v1
        args:
          comment: Issue Tracker Link - [{{ticketid}}]({{tracker[provider].baseurl}}{{ticketid}})
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}/) }}
  jira_ticket_in_branch: {{ branch.name | includes(regex=tracker[provider].pattern) }}
is:
  approved_author: {{ pr.author | match(list=[ 'github-actions', 'dependabot', '[bot]']) | nope }}
tracker:
  jira:
    baseurl: https://[orgName].atlassian.net/browse/
    pattern: r/\b[A-Za-z]+-\d+\b/
  1. The PR URL (as it contains the repo and PR identifiers)
    The PR is used with the following branch:
    feature/MP-1400
  2. Describe your PR relevant content
    The PR description is being generated by the linearb_ai_description automation rule
  3. Add relevant commit SHAExpected behavior
    A clear and concise description of what you expected to happen.
    I would expect the link url be <a href="https://myorg.atlassian.net/browse/MP-1400" rel="nofollow">MP-1400</a>

Screenshots

If applicable, add screenshots to help explain your problem.
Image

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions