PreflightCheckForCreatePR validates preconditions for creating a pull request. Returns an error if the working directory is dirty or the GitHub CLI is unavailable.
(verbose bool)
| 15 | // PreflightCheckForCreatePR validates preconditions for creating a pull request. |
| 16 | // Returns an error if the working directory is dirty or the GitHub CLI is unavailable. |
| 17 | func PreflightCheckForCreatePR(verbose bool) error { |
| 18 | if !isGHCLIAvailable() { |
| 19 | return errors.New("GitHub CLI (gh) is required for PR creation but not available") |
| 20 | } |
| 21 | if err := checkCleanWorkingDirectory(verbose); err != nil { |
| 22 | return fmt.Errorf("--create-pull-request requires a clean working directory: %w", err) |
| 23 | } |
| 24 | return nil |
| 25 | } |
| 26 | |
| 27 | // CreatePRWithChanges creates a new branch, stages and commits all current changes, |
| 28 | // pushes the branch, creates a pull request, and returns to the original branch. |
no test coverage detected