Skip to content

Conversation

@codegen-sh
Copy link
Contributor

@codegen-sh codegen-sh bot commented Mar 24, 2025

This PR addresses the issue where Codegen fails to create PRs in repositories that don't support draft PRs.

Changes

  1. Modified the create_pull method in GitRepoClient to:

    • Try creating a draft PR first if requested
    • If it fails with the specific error "Draft pull requests are not supported in this repository", fall back to creating a regular PR
    • Improve error handling and logging
  2. Added a new utility method accepts_draft_prs() to GitRepoClient that:

    • Provides a way to check if a repository supports draft PRs
    • Uses a heuristic based on repository visibility to avoid unnecessary API calls
    • Returns a boolean indicating whether draft PRs are supported

Testing

The implementation has been designed to:

  • Work without making additional API calls when possible
  • Gracefully handle the case where draft PRs are not supported
  • Maintain backward compatibility with existing code

Fixes CG-11610

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants