Skip to main content
Version: 2.x

Generated Files Are Owned by the Build

The CI plugin writes workflow files, so the question is who owns a file: the plugin or the developer. ZIO SBT gives two different answers, depending on the file.

Files the Build Ownsโ€‹

ci.yml, auto-approve.yml, auto-merge.yml and the other generated workflows belong to build.sbt. Every one starts with an "autogenerated" header and is rewritten by ciGenerateGithubWorkflow. A hand edit is lost at the next generation, and ciCheckGithubWorkflow fails until the file matches what the build would write. This is deliberate: the build is the single source of truth, and a pull request that changes a workflow shows the change in build.sbt too.

The same applies to .github/dependabot.yml. When a feature is switched off, the plugin deletes only a file that carries its header, never a hand-written one.

Files That Are Scaffolded Onceโ€‹

Two files are configuration of another tool and are expected to be edited by hand: .github/release-drafter.yml and .scala-steward.conf. The plugin writes them only the first time, when they do not exist. It never rewrites or deletes them afterward, and the drift check does not cover them.

Why a Check Existsโ€‹

A bot can change something that a generated file depends on, for example a Scala Steward bump of zio-sbt-ci itself. The committed files then no longer match what the build would write, and the lint job fails. The regenerate-workflows.yml workflow exists to fix exactly this on bot pull requests.

To keep the files in sync yourself, see Keep the Generated Workflow in Sync.

ZIO Chat

Hi there! ๐Ÿ‘‹ I'm ZIO Chat, your friendly neighborhood ZIO expert. I'm here to help you navigate the world of ZIO. Whether you're a seasoned pro or just starting out, fire away with your ZIO questions. I will hit you back with the best insights I've got. Let's dive into the world of ZIO together!