Documentation

Unity Version Control

Trigger create command reference

Find the options and arguments you can use to create triggers from the Unity Version Control command line.
Read time 2 minutesLast updated 5 days ago

The
cm trigger create
command creates a new trigger on a server.

Usage

cm trigger | tr create | mk <subtype-type> <new_name> <script_path> [--position=<new_position>] [--filter=<str_filter>] [--server=<repserverspec>]
cm tr
is an alias of
cm trigger
, and
mk
is an alias of
create
.

Options and arguments

The
cm trigger create
command accepts the following options and arguments:

Option or argument

Required

Description

subtype-type
YesTrigger execution and trigger operation. To see a list of trigger types, run
cm trigger showtypes
.
new_name
YesName of the new trigger.
script_path
YesDisk path on the server where the script to execute is located. If the path starts with
webtrigger
, Unity Version Control treats the trigger as a web trigger. For more information, refer to Remarks.
--position
NoPosition of the new trigger. This position must not be in use by another trigger of the same type.
--filter
NoChecks only items that match the specified filter.
--server
NoCreates the trigger on the specified server. If you don't specify a server, the command runs on the server that the client is configured to use. To learn more about server specifications, run
cm help objectspec
.

Remarks

To create a web trigger, set
script_path
to
webtrigger <target-uri>
. The trigger then sends a POST request to the URI. The request body contains a JSON object with the trigger environment variables and an
INPUT
key that holds an array of strings.

Example commands to create triggers

Create a trigger of type
after-setselector
:
cm trigger create after-setselector "BackupMgr" "/path/to/script" --position=4
Create a trigger of type
before-mklabel
on the server
myserver:8084
:
cm tr mk before-mklabel new "/path/to/script" --server=myserver:8084
Create a trigger that runs only when someone creates a label whose name starts with
LB
in the
myRep
repository:
cm tr mk after-mklabel Log "/path/to/script" --filter="rep:myRep,LB*"
Create a web trigger of type
after-checkin
:
cm tr mk after-checkin NotifyTeam "webtrigger http://myserver.org/api"

Additional resources