Desired situation:
on Github someone adds 1 or more people as reviewers to a PR, I want this to reflect in the Jira ticket
What already works:
- I get the correct issue from the PR titlte
- I can add a single reviewer
What doesn't work:
I cannot add multiple reviewers.
I have a lookup table to map github username to jira user id, which works for single users just fine. But I can't get it to work for multiple users, I tried:
- Just putting the whole array in the LUT `{{githubToJiraUsers(webhookData.pull_request.requested_reviewers.login)}}`
- Putting single values in the LUT `{{#githubToJiraUsers(webhookData.pull_request.requested_reviewers}}{{githubToJiraUsers({{login}})}}{{/}}`
- Use the for-each functionality of automation to update a variable
- Use the for-each functionality to update the issue directly with the current reviewer (removes the current reviewers already in the Issue AND only adds the last one)
- Use the for-each to do advanced field updating with JSON and use "update" (cannot get this to work)
Two of my many JSON attempts:
{
"update": {
"reviewers": {
"update": {{githubToJiraUser(login)}}
},
},
}
and
{
"update": {
"reviewers": [{
"add": "{{githubToJiraUser(login)}}"
}],
},
Json attempt:
Attempt with smart values list
I tried the smart value list in 2 ways:
These re the logs of those 2:
If anyone has any ideas how to approach this, help is greatly appreciated.
11-01-2024: (edited with screenshots)
Hi @Vincent -- Welcome to the Atlassian Community!
For a question like this, please post an image of your complete automation rule, images of any relevant actions / conditions / branches, an image of the audit log details showing the rule execution, and explain what is not working as expected. Those will provide context for the community to offer ideas. Thanks!
Until we see those...
I hypothesize you are trying to branch over the reviewers in the webhookData to add them one by one. And so there could be a problem in either parsing the reviewers or the branch handling. Seeing the rule may confirm this.
Kind regards,
Bill
Hi @Bill Sheboy
I updated the question! I hope I supplied enough additional information :)
Thank you for your time and help!
Kind regards,
Vincent
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
About the branching, when I do a loop and just set the users one by one, only the last one is saved, since "edit issue" overrides the current value.
When I do new user + {{issue.reviewers}} it only adds 1, because it seems like issue.reviewers is not updated on each iteration...
screenshot:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for those additional details, and your observation about the branching is correct:
Branches which could be on more-than-one-thing are executed in parallel and asynchronously. There is no guarantee of when the branch will complete, up to the end of rule processing. Please look here to learn more: https://support.atlassian.com/cloud-automation/docs/jira-automation-branches/#Ordering-of-branch-executions There is a suggestion to add an option for sequential versus parallel rule execution, and you may watch it to see any updates: https://jira.atlassian.com/browse/AUTO-32
What this means for your rule is the edits repeatedly walk-over the Reviewers, and there is no way to predict what values will be in there when the rule completes.
The work-arounds to ensure your rule behaves as expected are:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.