Skip to content

Handle repositories that don't support draft PRs#829

Draft
codegen-sh[bot] wants to merge 2 commits intodevelopfrom
gen/926c57ee-d977-412b-b396-a47b671bfdd4
Draft

Handle repositories that don't support draft PRs#829
codegen-sh[bot] wants to merge 2 commits intodevelopfrom
gen/926c57ee-d977-412b-b396-a47b671bfdd4

Conversation

@codegen-sh
Copy link
Contributor

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

Description

This PR addresses the issue described in CG-11610 by implementing a fallback mechanism for repositories that don't support draft PRs.

Changes

  • Modified the create_pull method in GitRepoClient to:
    • First attempt to create a draft PR when requested
    • Catch GitHub exceptions with status code 422 that mention "draft" in the error message
    • Fall back to creating a regular PR when draft PRs aren't supported
    • Log appropriate warning messages

Testing

The implementation has been tested with:

  • Repositories that support draft PRs (normal behavior)
  • Repositories that don't support draft PRs (falls back to regular PR)

This change ensures that the PR creation process is more robust and works across all GitHub repositories, including older GitHub Enterprise Server instances that may not support draft PRs.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


codegen-bot seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

1 participant