Skip to main content
Create a new change, optionally applying initial file operations atomically. File content must be base64-encoded. Required scope: write
import base64
from mesa_sdk import Author, FileDelete, FileUpsert

change = await mesa.changes.create(
    repo="app",
    base_change_id="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz",
    message="Add README",
    author=Author(name="Docs Bot", email="docs@example.com"),
    files=[
        FileUpsert(
            path="README.md",
            content=base64.b64encode(b"# App\n").decode(),
        ),
        FileDelete(path="old.txt"),
    ],
)

Options

repo
str
required
Repository name.
base_change_id
str
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
str | None
Organization override.
message
str | None
Change description. Required when files is non-empty. When files is omitted, pass None to omit the field and create the change with no description, or pass "" explicitly.
author
Author | None
Commit author identity. When omitted, the server fills an identity derived from the API key.
committer
Author | None
Committer identity. When omitted, the server falls back to author.
files
list[FileChange] | None
File operations to apply atomically. Entries are FileUpsert or FileDelete.

Response

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

CommitIdentity

name
str
Author or committer display name.
email
str
Author or committer email address.
date
datetime | None
Timestamp for this identity when provided.