Skip to content

Commit ac7bb76

Browse files
authored
fix: Provide helpful guidance for common PR creation failures (#148)
1 parent e31479d commit ac7bb76

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

plugins/titan-plugin-github/titan_plugin_github/steps/create_pr_step.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,20 @@ def create_pr_step(ctx: WorkflowContext) -> WorkflowResult:
9999
metadata={"pr_number": pr["number"], "pr_url": pr["url"]},
100100
)
101101
except GitHubAPIError as e:
102-
ctx.textual.error_text(f"Failed to create pull request: {e}")
102+
error_msg = str(e)
103+
104+
# Check for common errors and provide helpful guidance
105+
if "No commits between" in error_msg or "Head sha can't be blank" in error_msg:
106+
ctx.textual.error_text(f"Failed to create pull request: {e}")
107+
ctx.textual.text("")
108+
ctx.textual.warning_text("💡 The branch might not be pushed to the remote repository.")
109+
ctx.textual.text("")
110+
ctx.textual.dim_text("To fix this, push your branch and try again:")
111+
ctx.textual.dim_text(f" git push -u origin {head}")
112+
ctx.textual.text("")
113+
else:
114+
ctx.textual.error_text(f"Failed to create pull request: {e}")
115+
103116
ctx.textual.end_step("error")
104117
return Error(f"Failed to create pull request: {e}")
105118
except Exception as e:

0 commit comments

Comments
 (0)