Skip to main content

Method signature

Description

The createPullRequest method allows you to create a GitHub pull request after code changes have been generated using any supported agent (Codex, Claude, OpenCode, or Gemini). This method streamlines the process of submitting code changes for review by automatically creating a pull request with the generated modifications.

Parameters

LabelOptions Interface

Return type

PullRequestResponse Interface

Requirements

  • Agent Type: This method is available for all supported agents (Codex, Claude, OpenCode, and Gemini)
  • Initialization: The VibeKit instance must be properly initialized with valid agent configuration
  • Code Generation: Code changes should be generated before creating a pull request
  • GitHub Integration: A valid GitHub token must be configured using withSecrets({ GH_TOKEN: "your_token" })
  • Repository Access: The provided GitHub token must have access to the specified repository

Error handling

The method throws errors in the following scenarios:

Initialization Error

  • When: The agent is not properly initialized
  • Resolution: Verify your VibeKit configuration includes valid agent settings and GitHub configuration

Usage examples

Basic Usage

Advanced Usage with Parameters

Additional Label Examples

Using with Different Agents

Notes

  • The pull request is automatically labeled with the agent type (‘codex’, ‘claude’, ‘opencode’, or ‘gemini’) to indicate which agent created it
  • Ensure your GitHub token has the necessary permissions to create pull requests in the target repository
  • The method creates a new branch for the pull request automatically
  • Code changes must be generated before calling this method
  • Repository must be explicitly cloned using cloneRepository() before generating code
  • When using branchPrefix, the final branch name will be in the format {branchPrefix}/{generated-suffix}
  • The labelOptions parameter creates a new label if it doesn’t exist in the repository and applies it to the pull request
  • The response includes the complete GitHub API pull request data, allowing access to detailed information like user details, branch information, timestamps, and merge status
  • The repository parameter is now required and specifies which repository to create the pull request in