Skip to content

The monochange book · Migration guides

Upgrading to 0.20

Version 0.20 builds hosted release commits from a git tree the workflow uploads with its own token, and changes one library API. Repositories that don't use the hosted backend or the Rust crates directly need no changes.

Each section states who is affected, what changed, and the exact update step. The complete change list for this release lives in changelog.md.

Hosted release jobs need contents: write

Affects: GitHub Actions jobs that run CommitRelease with the hosted backend.

The CLI now uploads the release files as git blobs and a tree with the job's GITHUB_TOKEN (or GH_TOKEN) and sends monochange.dev only the tree id. A job with contents: read, or without a token in its environment, still works: the CLI prints a warning and sends the file contents instead, which only supports UTF-8 text files and requests up to 8 MiB.

Update steps:

  • Grant contents: write to the release job and pass the token to the step:
permissions:
  contents: write
  pull-requests: read
  id-token: write
steps:
  - run: monochange run release
    env:
      MONOCHANGE_RELEASE_BACKEND: hosted
      GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  • Optionally replace a backend choice input that only switched commit_backend and backend to hosted with MONOCHANGE_RELEASE_BACKEND: hosted on the release job.

Library APIs

Affects: Rust code that depends on monochange_core.

monochange_core::HostedCommitRequest gains tree: Option<String>, the tree the workflow already created. Struct literals must add the field:

// before
let request = HostedCommitRequest { owner, repository, branch, base_commit, files, /* … */ };

// after
let request = HostedCommitRequest {
	owner,
	repository,
	branch,
	base_commit,
	files,
	tree: None,
	/* … */
};

Serialized requests omit tree when it is None and omit files when it is empty, so older payloads still deserialize.

Edit this chapter on GitHub