For others coming across this, it is better to run astro check in CI. It doesn't require running astro sync and also checks .astro files, config etc. as well as running type checks.
astro check
astro sync