^I custom programmed a CNC machine to do that. i programmed thousands of boards with it. I gave the firmware a "wookie wiggle" option, for the time I accidentally ordered boards with paste layer on the ICSP pads, so that the serrated pins would dig through the flux residue and/or oxide layer.
When it lowered and made contact, it detected the voltage on the pins and triggered the programmer.
I just programmed mine to start flashing after lowering the Z axis. And it moves to the next position after receiving a programming verify, so on error it stops and waits for human intervention. I actually made my own controller from scratch. Just a micro and transistors to move the steppers in a grid/array, adjustable for number of rows and columns, X and Y travel, an input for programming verify, and an output to trigger the programmer. There is a start button and a clear/home/abort.
But ultimately, if just doing ICSP (not board/assembly diagnostics) I found it is much easier to flash the bare chips. Except for stupid QFP's, it is much easier and compact to handle chips than panels of boards. This means you can load a crapton of chips at a time, vs loading a CNC machine with panels of say 12-30 boards, every 5 or 10 minutes, all day. And there is less tolerance stacking to bother about if you can design a machine mechanism to program bare chips vs boards. You don't need optical correction or whatnot. I flash my own DIP gullwing down to SOP and even QFN chips. The latter is a bugger to get dialed in, initially, but once that is over, I have never had to fidget with the mechanism, again. It requires some extensive setup time to add a new chip or even pinout to the system, but it's good for medium volume use without paying 10 cents per for the privilege and allowing bulk purchases of blank chips vs trying to figure out how many flashed chips to order to get the best price without getting stuck with too many leftover... or discovering a bug or otherwise requiring a firmware update the day your flashed chips arrive. I can just reflash the flashed chips.
This is convenient for me to the point I have ordered boards completely assembled except for the micros. And I hand solder just the flashed micros to the board. This is obviously a bit more work than just flashing assembled boards, but it avoids customs fee of importing microcontrollers from China.
i still put the ICSP header on the PCB, in case of firmware tweaks post-assembly. But I have retired the CNC machine method of programming boards. Too fidgety due to pcb tolerances unless you make the pads rather large. I've pretty much settled on 0.05" pitch pads (same as Tag Connect), and I like to keep it that way for now.