Skip to content

Add branch push support to PR creation workflow#7

Merged
csvenke merged 1 commit intomainfrom
feature/gh-pr-update-2
Mar 15, 2026
Merged

Add branch push support to PR creation workflow#7
csvenke merged 1 commit intomainfrom
feature/gh-pr-update-2

Conversation

@csvenke
Copy link
Copy Markdown
Owner

@csvenke csvenke commented Mar 15, 2026

Summary

Implements automatic branch pushing when creating pull requests. If a branch doesn't have an upstream, it will be automatically pushed to the origin before PR creation.

Key Changes

  • Client Interface: Added HasUpstream() and PushWithUpstream() methods to the gh.Client interface
  • Git Operations: Implemented upstream checking and branch pushing in RealClient
  • PR Command: Modified to fetch current branch and pass it to the pull request creation function
  • PR Creation Logic:
    • Created new CreatePullRequestWithBranch() function that handles upstream checking and branch pushing
    • Maintained backward compatibility by keeping original CreatePullRequest() function
    • Updated function signature to accept branch name and git client parameters
  • Tests: Added comprehensive test coverage for the new branch push functionality including error cases

Implementation Details

  • Branch pushing only occurs when both branch name and git client are provided
  • Gracefully handles cases where upstream already exists (skips unnecessary push)
  • Proper error handling for upstream checking and push operations

- Add HasUpstream and PushWithUpstream methods to Client interface
- Implement upstream detection and branch pushing in RealClient
- Add CreatePullRequestWithBranch that automatically pushes branch if no upstream
- Update pr command to pass branch and git client to pull request creation
- Add comprehensive tests for upstream checking and branch pushing logic
@csvenke csvenke merged commit aaf6349 into main Mar 15, 2026
3 checks passed
@csvenke csvenke deleted the feature/gh-pr-update-2 branch March 15, 2026 18:35
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