> ## Documentation Index
> Fetch the complete documentation index at: https://docs.automate.ax/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Automate.ax automations are TypeScript programs.
> Use Bun for installation and command examples.
> Use Automate.ax for the product name and automate.ax for the package, CLI, and domain.
> Treat documented public APIs as current; do not invent transitional or deprecated names.

# Create or update GitHub repository file

> Create or replace one GitHub repository file in a commit.

`github.createOrUpdateRepositoryFile` creates a file or replaces an existing file through GitHub's Contents API.

```ts automations/update-github-file.automation.ts theme={null}
import { automation } from "automate.ax"
import { github } from "automate.ax/github"

export default automation("Update GitHub config", () => {
  github.createOrUpdateRepositoryFile({
    branch: "main",
    commitMessage: "Update deployment config",
    contentBase64: "eyJlbmFibGVkIjp0cnVlfQ==",
    owner: "SentsCo",
    path: "deployment.json",
    repository: "automate.ax",
  })
})
```

Provide the repository, `path`, Base64-encoded `contentBase64`, and `commitMessage`. Add the existing blob `sha` when replacing a file. Optional `branch` defaults to the default branch; `author` and `committer` accept `{ name, email }`. Returns the commit `sha` and the content `path` and `sha`. Requires Contents write permission.

This action rejects paths under `.github/workflows/`. Use `github.createOrUpdateWorkflowFile` for workflow files so Automate.ax requests GitHub's additional Workflows write permission only when GitHub requires it.
