The ci_post_clone.sh is needed with the following contents:
# !/bin/sh
brew install cocoapods
pod install
The script must be located in: <project_root>/ci_scripts/ci_post_clone.sh
Also the naming of files and folders must be exact.
These links were helpful:
https://developer.apple.com/documentation/xcode/making-dependencies-available-to-xcode-cloud#Use-a-custom-build-script-to-install-a-third-party-dependency-or-tool
https://developer.apple.com/documentation/xcode/writing-custom-build-scripts