Skip to main content
Create a new change, optionally applying initial file operations atomically. File content must be base64-encoded. Required scope: write
import { Buffer } from 'node:buffer';

const change = await mesa.changes.create({
  repo: 'app',
  base_change_id: 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz',
  message: 'Add README',
  author: { name: 'Docs Bot', email: 'docs@example.com' },
  files: [
    {
      path: 'README.md',
      content: Buffer.from('# App\n').toString('base64'),
    },
    { path: 'old.txt', action: 'delete' },
  ],
});

Options

repo
string
required
Repository name.
base_change_id
string
required
Change to create the new change on top of. Use Mesa’s virtual root change ID for the first change in an empty repository.
org
string | undefined
Organization override.
message
string | undefined
Change description. Required when files is non-empty. When files is omitted, omit message to create the change with no description, or pass "" explicitly.
author
object | undefined
Commit author identity. Required when files is non-empty.
committer
object | undefined
Committer identity. When omitted, the server falls back to author.
files
array | undefined
File operations to apply atomically. Upserts use { path, content, encoding?, action?, mode? }; deletes use { path, action: 'delete' }.

Response

id
string
Change ID.
current_commit_oid
string
Current commit OID for the change.
is_conflicted
boolean
Whether the current commit still contains unresolved conflicts.
message
string
Current change description. Empty string means the change has no description.
author
CommitIdentity
Commit author identity.
committer
CommitIdentity
Committer identity.
parents
string[]
Parent change IDs for this change.
created_at
string
Creation time.
updated_at
string
Last update time.

CommitIdentity

name
string
Author or committer display name.
email
string
Author or committer email address.
date
string | undefined
Timestamp for this identity when provided.