Determine in an automation if a story was already created

Tiago Pinheiro May 25, 2022

I'm not fiding a solution for this hope someone can help me, I have an automation with github for PRs, the automation is based on when a specific label is added to a PR on github a story is created on jira, my problem is that after if someone adds more labels the story is being created again and again. 

I tried to use a JQL condition like summary !~ 'Review PR {{webhookData.pull_request.number}}' to check if the story was already created but it does not work.

Any help here on how I can check if the story for the PR was already created? 

1 answer

1 accepted

0 votes
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 25, 2022

Hi @Tiago Pinheiro -- Welcome to the Atlassian Community!

When you note "it does not work" what do you observe happening?

Next, if you test that JQL manually with an known PR number, does it work as you expect?

Finally, I would expect that JQL to return a lot of issues using NOT CONTAINS (!~) so perhaps:

  • instead try matching on the PR number with the JQL,
    • summary ~ "Review PR {{webhookData.pull_request.number}}"
  • storing the results in a Lookup Issues action, and
  • then only proceed when {{lookupIssues.size|0}} equals 0 (using an advanced compare condition.

Kind regards,
Bill

Tiago Pinheiro May 26, 2022

Not sure if I added it the right way, but added a Branch rule with JQL with the query above + the Advanced compare condition with  {{lookupIssues.size|0}} equals 0 but it's not working 

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 26, 2022

Did you first test the JQL with an example PR Number in advanced issue search?  That will confirm the JQL is working before you try anything else.

And, rather than using a branch, instead use the JQL with the Lookup Issues action.  Then you can test the result in the condition.

Tiago Pinheiro May 27, 2022

Thanks, it works, didn't notice that there was a Lookup Issues action

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events