Skip to content

Stop committing derived metadata to main in KtsuBuild #6

Description

@matt-edmondson

Context

KtsuBuild commits VERSION.md, CHANGELOG.md, and LATEST_CHANGELOG.md back to main during a release, then pushes. MetadataService stages them, commits as Github Actions, and calls GitService.PushAsync.

That push is the single reason branch rulesets cannot be enforced on this org. github-actions[bot] holds write, not admin, and GitHub Actions cannot be a ruleset bypass actor here because it is not an installed app. So any ruleset requiring a pull request blocks releases.

The observation

The commit is not needed for a correct release. CiCommand.cs:124 already computes shouldCommitMetadata = buildConfig.IsOfficial && buildConfig.IsMain and passes it as CommitChanges. When false, MetadataService still writes the files into the workspace, it just does not commit or push them, and ReleaseHash falls back to the current HEAD.

The build reads VERSION.md off disk, not out of git. Sdk.Common.MetadataFiles.props reads it at build time, and KtsuBuild writes it before the build runs. So the published package carries the right version whether or not the file is ever committed.

These are derived artifacts. The version comes from git tags, and the changelog comes from commit history. Committing them back into source is what created the constraint.

What changes if the commit is dropped

Gained: no push to main during a release, so a strict ruleset needs no bypass actor and works everywhere.

Lost:

  • VERSION.md in each repo goes stale between releases, so a local dotnet pack produces a stale version number
  • CHANGELOG.md stops accumulating in the repo. The GitHub release body is unaffected, since LATEST_CHANGELOG.md is generated in the workspace

Acceptance criteria

  • A decision on whether stale in-repo metadata is acceptable
  • If yes, shouldCommitMetadata no longer returns true for official main builds, or the behaviour is put behind a setting
  • A release is verified to still produce the correct package version and release notes
  • The ruleset issue is revisited, since this unblocks the strict option

Note

This deserves its own design discussion rather than being bolted onto the Terraform work. It changes release behaviour across every repo in the org.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions