  We study the efficiency fluctuations of a stochastic heat engine made of $N$
interacting unicyclic machines and undergoing a phase transition in the
macroscopic limit. Depending on $N$ and on the observation time, the machine
can explore its whole phase space or not. This affects the engine efficiency
that either strongly fluctuates on a large interval of equiprobable
efficiencies (ergodic case) or fluctuates close to several most likely values
(nonergodic case). We also provide a proof that despite the phase transition,
the decay rate of the efficiency distribution at the reversible efficiency
remains largest one although other efficiencies can now decay equally fast.
