> ## 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 cloud pull request

> Create a GitHub pull request from a completed Codex cloud turn.

`createCodexCloudPullRequest` publishes the diff from a completed Codex cloud turn as a GitHub pull request.

```ts automations/create-codex-pr.automation.ts theme={null}
import { automation, onSchedule } from "automate.ax"
import { createCodexCloudPullRequest } from "automate.ax/codex"

export default automation("Create Codex PR", () => {
  onSchedule({ schedule: "0 11 * * 1-5" })
  const request = createCodexCloudPullRequest({
    draft: true,
    taskId: "task_e_abc123",
  })

  request.turnId
  request.url
})
```

The task's current completed assistant turn is used by default. Pass `turnId` to publish another completed attempt. `draft` defaults to `false`. Optional second argument `{ account }` defaults to the project binding. PR creation is asynchronous; call `getCodexCloudTask` until its `pullRequests` contains the resulting GitHub URL and metadata.

<Warning>
  Codex Cloud does not currently provide an official public REST API. This
  action calls undocumented ChatGPT backend endpoints that may change without
  notice.
</Warning>
