Well it's not hard, you just have to know a couple of things.
Here's my topic where I asked the exact same thing https://wildfiregames.com/forum/index.php?/topic/24774-garrison-units-from-the-editor/&tab=comments#comment-361355
Basically you've to "invoke" a trigger script and let it do what you want; in this case I wanted to garrison people, so:
1- Trigger:
Trigger.prototype.InitMyMap_GarrisonBuildings = function()
2- Who do I want to garrison? I want infantry units, he'll decide which ones; they have to be romans and be Elite:
let romeInfantryUnits = TriggerHelper.GetTemplateNamesByClasses("CitizenSoldier+Infantry", "rome", undefined, "Elite", true);
3- Where and how many people do I want to garrison? I want the 20% of the maximum garrison number in everything that responds to the class of tower; they've to be Roman infantry units, belonging to player 1:
TriggerHelper.SpawnAndGarrisonAtClasses(2, "Tower", romeInfantryUnits, 1);
Before you do anything, though, you've to tell the game he's to look where the triggers are, in my case in
"scripts/TriggerHelper.js",
"skirmishes/Gauls_vs_Romans.js"
The first one is the reference for triggers in the whole game, the second one is my personal script referred to that particular map