For now, setup-cocoapods always re-install cocoapods version if you specify version: latest as input. Sometimes, when latest version is already pre-installed to image, it is just waste of time.
if version: latest, action should retrieve the latest version from remote via gem list cocoapods --remote --exact and compare with currently installed version. If they are the same, nothing should be done.