Hi Ollie, in my support ticket you mentioned using webhooks and a custom server to do things like sending out email notifications as that’s not supported right now. I tried doing this (which also addresses the two problems of filtering + customizing messages) but it still has some shortcomings due to the lack of information being sent:
- There’s no one field that lists all the reviewers. PLASTIC_REVIEW_ASSIGNEE only lists a single reviewer. This means that when a code review status is updated, I don’t have access to who all the reviewers are in order to notify them.
- Moreover, if there is a user group like “Developers”, it doesn’t give the emails or any details of who’s in that user group. This means I would need to hardcode this information in the custom webhook server.
- It’s a little unclear as to when a code review is created. PLASTIC_REVIEW_ACTION is not set when a code review is created, which is unexpected to me.
- There’s no URL to the PR, which adds some inconvenience to the reviewer who needs to find the PR.
As an immediate and actionable ask, would it be possible for Unity to add all of the reviewers as a comma separated list in the webhook data? And ideally, if Unity could resolve the user group aliases on the backend side so that “Developers” for instance gets expanded into “developerA@company.com, developerB@company.com”… this would become a viable workflow for us.
I would also like to request that PLASTIC_REVIEW_ACTION be set when a code review is created, and a URL pointing to the review (instead of just the review ID) be added as well.
Here’s some of the data I’m seeing:
Code Review is created:
Received webhook: {
PLASTIC_USER: 'author@company.com',
PLASTIC_CLIENTMACHINE: 'Server:production-east-us-01',
PLASTIC_SERVER: 'organization@production-east-us-01:port',
PLASTIC_REVIEW_ID: '26138',
PLASTIC_REPOSITORY_NAME: 'chibi-hz',
PLASTIC_REVIEW_TITLE: 'Testing Webhook',
PLASTIC_REVIEW_STATUS: 'Under review',
PLASTIC_REVIEW_TARGET_TYPE: 'branch',
PLASTIC_REVIEW_TARGET: '/main/test',
INPUT: '[]',
content: 'New code review `Testing Webhook` created\n'
}
For each reviewer, there is then a separate webhook trigger with:
PLASTIC_REVIEW_ACTION: ‘add reviewer’,
PLASTIC_REVIEW_ACTION_INFO: ‘reviewer@company.com’,
PLASTIC_REVIEW_ASSIGNEE: ‘reviewer@company.com’,
Code Review is edited:
Received webhook: {
PLASTIC_USER: 'author@company.com',
PLASTIC_CLIENTMACHINE: 'Server:production-east-us-01',
PLASTIC_SERVER: 'organization@production-east-us-01:port',
PLASTIC_REVIEW_ID: '26138',
PLASTIC_REPOSITORY_NAME: 'chibi-hz',
PLASTIC_REVIEW_TITLE: 'Testing Webhook (test renaming)',
PLASTIC_REVIEW_STATUS: 'Under review',
PLASTIC_REVIEW_TARGET_TYPE: 'branch',
PLASTIC_REVIEW_TARGET: '/main/test',
PLASTIC_REVIEW_ACTION: 'edit title',
PLASTIC_REVIEW_ACTION_INFO: "'Testing Webhook (test renaming)'",
PLASTIC_REVIEW_COMMENT_ACTION: '',
PLASTIC_REVIEW_COMMENT: '',
INPUT: '[]',
content: 'New comment to the review `Testing Webhook (test renaming)`\nUnder review'
}