How can I setup a Automation rule only for PRs matching certain criteria?

Bharat Patel August 17, 2020

I am trying to  create an Automation rules to transition linked Jira issue(s) to `Done` when a PR is merged.

Right now since there is no additional configuration for  "PR merged" trigger, my rule is running for every PR, but for my usecase I want this rule to trigger only or PRs matching certain criteria, e.g. when PR title has some keyword. How can I accomplish this? 

1 answer

0 votes
Stuart Capel - London
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 17, 2020

Hi @Bharat Patel 

You can add a 'condition' 

Capture.PNG'Issue fields condition' will let you search for keywords in the summary.

Hope this helps, let me know if I've misinterpreted your question.

Bharat Patel August 17, 2020

hi @Stuart Capel - London actually I want to define a condition based on PR title, e.g. PR title contains "#mergeit", not on JIRA issue fields. 

Stuart Capel - London
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 18, 2020

Ah! Sorry Bharat,

I see what you're after now.

I haven't had chance to test this myself but I wanted put it out there whilst I look into it. 

I believe you can create a webhook in Bitbucket (https://support.atlassian.com/bitbucket-cloud/docs/manage-webhooks/) and use 'merged' from the pull request triggers.

Then use that incoming webhook as a trigger in the automation rule and for the condition you can use 'advanced compare condition' to specify {{webhookData.title}} > equals > #mergeit

I'll try and test this tonight but let me know if you confirm or deny this works before I do :)

Bharat Patel August 18, 2020

hi @Stuart Capel - London 

Thanks for your reply and that suggestion, that would have worked perfectly only if Bitbucket webhook included JIRA issues in the webhook data :) 

I can get the automation to trigger conditionally via webhook approach, but problem now is it can't find the JIRA issues to act on. 

Screen Shot 2020-08-18 at 8.52.14 AM.png

Thanks

-Bharat

Stuart Capel - London
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 18, 2020

Oh man, we're so close! 😂

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events