Actions
A template can do things as well as contain them. An action is attached to one folder or file in the template, and either runs as that item is created or keeps working on files that land in the folder long after the deploy has finished.
Where actions live
Actions are written in the template's Automation tab. Each one has a name, a trigger, a type and its own settings, and it sits in the template until you attach it to something.
Attaching happens in the Structure tab: select a folder or a file, choose Add Action, and pick from the list. The picker shows this template's own actions first, then anything library-wide under a Globals heading - see Global actions.


One action can be attached to as many items as you like. The editor says how many are using it - "Used by 3 nodes" - and editing the action changes what happens at every one of them. That is the point of defining it once: a template with five folders that each need the same command carries one action, not five copies of it.
The two triggers
Every action is one of two things, and the editor asks which before anything else.
On deploy runs the action once, as the folder or file it is attached to is created.
Watch the folder runs it on every matching file that arrives in that folder afterwards, for as
long as Prefab is running. Choosing it adds a Which files box - a list of extensions such as
png jpg heic, or nothing at all to mean any file - and a switch for Also when a file is
edited, which runs the rule again when a file already there is saved over.
A watching action does not run at deploy. Prefab registers the folder instead, and the rules take over from there. Everything about that side of it is in What watched folders do.
A watching action has to be attached to a folder, because it acts on the files that land in one. Attach it to a file and the deploy reports that the item cannot be watched.
What an action can do on deploy
Three types run at deploy time.
Terminal command runs a shell command in the folder that was created - git init,
npm install, anything you would type yourself. Placeholders in the command are replaced first, so
git commit -m "Start of {{project_name}}" uses the values you gave for that deploy. Commands are
off until you turn them on and install a small helper script; see
Terminal commands.
Open in app opens the created item in an application you pick from a list of the ones installed on this MacPC.
Reveal in FinderShow in Explorer shows and selects the created item in FinderFile Explorer. This is per-item, and separate from the template-wide Reveal in FinderShow in Explorer switch at the foot of the Automation tab, which shows the folder the template made as a whole.
The remaining action types - renaming, converting, resizing, tagging, filing away - act on a file rather than a folder, so they are only offered once you have chosen Watch the folder. They are listed in the Rule reference. Switch such an action back to On deploy and its type resets to Reveal in FinderShow in Explorer, because there would be nothing for the old one to act on.
Order, and what happens when one fails
Actions attached to the same item run in the order they were attached, each one after the item itself exists. If an action fails, the deploy carries on and reports it at the end rather than stopping silently.
A failed terminal command is the exception. The actions after it on that same item are skipped, on the grounds that a command which could not run has probably left the folder in no state for the next one. Switch on Continue on error in the command's settings if you would rather the rest ran anyway.
Two other things are reported rather than passed over. An action attached to an item you have since deleted from the template says so, instead of quietly doing nothing. So does an action that points at a shared definition the template no longer has.
Turning an action off
Every action has an Enabled switch. A disabled action stays in the template, keeps its settings and shows as Disabled in the picker, but does not run - useful for a command you want back next month rather than gone.
Disabling changes what future deploys do, and nothing else. Folders that are already being watched carry their own copy of the rules from the day they were deployed, so they are unaffected. See Managing and undoing for what to do about those.