Example triggers
Explore example triggers for automating workflows in Unity Version Control.
Read time 1 minuteLast updated 21 days ago
The following examples show you sample triggers that you can use to optimize your version control workflows.
Backup trigger
Create a trigger that fires after setting a workspace selector, located at/home/scripts/plastic-backupcm trigger create after-setselector backup /home/scripts/plastic-backupValidation triggers
Label validation
Create a trigger called that fires before a label is created, that callsvalidate-label.batmyserver8084cm trigger create before-mklabel "Validate label" "c:\tmp\triggers\validate-label.bat" --server=myserver:8084cm trigger create before-mklabel "label-bl-fix" "c:\tmp\triggers\label-bl-fix.bat" --filter="rep:default,bl*,fix*"Check in validation
Create a trigger that validates check in contents before the check in is actually performed in the repository, on a Windows server:cm trigger create before-checkin ensure-code-stds "c:\plastic\triggers\checkcode.bat"Web trigger notifications
URI notification
Create a web trigger that fires after a check in action is performed, at URIhttps://www.mysite.com/api/team/checkinNotify teamcm trigger create after-checkin "Notify team" "webtrigger https://www.mysite.com/api/team/checkin"{ "PLASTIC_CHANGESET": "cs:2341@br:/main/task4638@rep:product@repserver:plastic.mysite.com:17590", "PLASTIC_CLIENTMACHINE": "DEV1HOST", "PLASTIC_COMMENT": "Fixing command line parsing", "PLASTIC_SERVER": "plastic.mysite.com:17590", "PLASTIC_SHELVE": false, "PLASTIC_USER": "dev1", "INPUT": [ "CH \"/src/main.c\" FILE" ]}
Discord notification
Create a web trigger that fires after a check in and send notifications from the server to the specified Discord channel:cm trigger create after-checkin NotifyTeam "webtrigger-discord https://discordapp.com/api/webhooks/<channelId>/<token>" --server=localhost:18084Slack notification
Create a web trigger that fires after a check in and send notifications from the server to the specified Slack channel:cm trigger create after-checkin SlackWebTrigger "webtrigger-slack https://slack.com/api/chat.postMessage/<channelId or UserId>/xoxb-SlackBotToken" --server=localhost:18084