gitstream icon indicating copy to clipboard operation
gitstream copied to clipboard

Incorrect link with Link-JIRA Automation Rule

Open rjop-hccgt opened this issue 10 months ago • 1 comments

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.

rjop-hccgt avatar Apr 25 '25 17:04 rjop-hccgt

worth mentioning that I've tried changing this

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

to

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

And the link doesn't appear with this change

rjop-hccgt avatar Apr 25 '25 17:04 rjop-hccgt

Thank you! fixing it: https://github.com/linear-b/gitstream/pull/713

vim-zz avatar May 13 '25 07:05 vim-zz