Distributes a shared .codacy.yaml to the root of every repository listed in
repos.txt, by committing directly to each repo's default branch.
.codacy.yaml— the template config. Edit this file to change what gets deployed to every target repo.repos.txt— one target repo per line, asgroup/subgroup/project(the path portion of its GitLab URL). Blank lines and#comments are ignored.deploy-config.sh— for each repo inrepos.txt, shallow-clones it, overwrites.codacy.yaml, and commits + pushes only if the file changed. Continues past per-repo failures and exits non-zero if any repo failed..gitlab-ci.yml— a single manualdeploy-configjob that runs the script. Trigger it from the GitLab pipeline UI whenever you want to push the current.codacy.yamlout to all listed repos.
- Create a GitLab group access token with
write_repositoryscope (or a personal access token with equivalent rights) covering all target repos. - Add it as a masked, protected CI/CD variable named
CODACY_DEPLOY_TOKENon this project (Settings → CI/CD → Variables). - Add target repos to
repos.txt. - Run the
deploy-configjob manually from a pipeline.
- This pipeline only runs on GitLab CI. Target repos are assumed to live on
GitLab (
CI_SERVER_HOST), sincedeploy-config.shclones overhttps://oauth2:<token>@<gitlab-host>/<repo>.git. - If this source repo is also mirrored to GitHub, that mirror is for hosting
only — GitHub Actions does not run
.gitlab-ci.yml.