CreatePR creates a pull request via `gh pr create` and returns the PR URL.
(dir, branch, title, body string)
| 37 | |
| 38 | // CreatePR creates a pull request via `gh pr create` and returns the PR URL. |
| 39 | func CreatePR(dir, branch, title, body string) (string, error) { |
| 40 | cmd := exec.Command("gh", "pr", "create", |
| 41 | "--head", branch, |
| 42 | "--title", title, |
| 43 | "--body", body, |
| 44 | ) |
| 45 | cmd.Dir = dir |
| 46 | out, err := cmd.CombinedOutput() |
| 47 | if err != nil { |
| 48 | return "", fmt.Errorf("failed to create PR: %s", strings.TrimSpace(string(out))) |
| 49 | } |
| 50 | return strings.TrimSpace(string(out)), nil |
| 51 | } |
| 52 | |
| 53 | // PRTitleFromPRD generates a conventional-commits title for a PR. |
| 54 | // Format: feat(<prd-name>): <project name> |
no outgoing calls
no test coverage detected