Skip to content

fix: CG-11708 set draft=False if repo is private #835

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/codegen/git/clients/git_repo_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ def get_or_create_pull(
pull = self.create_pull(head_branch_name=head_branch_name, base_branch_name=base_branch_name, title=title, body=body)
return pull

# TODO: update params to match super
def create_pull(
self,
head_branch_name: str,
Expand All @@ -199,6 +198,13 @@ def create_pull(
) -> PullRequest | None:
if base_branch_name is None:
base_branch_name = self.default_branch

# draft PRs are not supported on all private repos
# TODO: check repo plan features instead of this heuristic
if self.repo.visibility == "private":
logger.info(f"Repo {self.repo.name} is private. Disabling draft PRs.")
draft = False

try:
pr = self.repo.create_pull(title=title or f"Draft PR for {head_branch_name}", body=body or "", head=head_branch_name, base=base_branch_name, draft=draft)
logger.info(f"Created pull request for head branch: {head_branch_name} at {pr.html_url}")
Expand Down
Loading