Skip to content

Commit 6233a5a

Browse files
authoredMar 13, 2025··
fix: CG-11708 set draft=False if repo is private (#835)
a better solution would be to use graph QL to pull the repo plan features - this is a temporary one for eitan
1 parent 421e23a commit 6233a5a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed
 

‎src/codegen/git/clients/git_repo_client.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ def get_or_create_pull(
188188
pull = self.create_pull(head_branch_name=head_branch_name, base_branch_name=base_branch_name, title=title, body=body)
189189
return pull
190190

191-
# TODO: update params to match super
192191
def create_pull(
193192
self,
194193
head_branch_name: str,
@@ -199,6 +198,13 @@ def create_pull(
199198
) -> PullRequest | None:
200199
if base_branch_name is None:
201200
base_branch_name = self.default_branch
201+
202+
# draft PRs are not supported on all private repos
203+
# TODO: check repo plan features instead of this heuristic
204+
if self.repo.visibility == "private":
205+
logger.info(f"Repo {self.repo.name} is private. Disabling draft PRs.")
206+
draft = False
207+
202208
try:
203209
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)
204210
logger.info(f"Created pull request for head branch: {head_branch_name} at {pr.html_url}")

0 commit comments

Comments
 (0)
Please sign in to comment.