Create pull request using GitHub CLI.
(new_version: str, description: str, branch_name: str)
| 518 | |
| 519 | |
| 520 | def create_pull_request(new_version: str, description: str, branch_name: str): |
| 521 | """Create pull request using GitHub CLI.""" |
| 522 | print("🔀 Creating pull request...") |
| 523 | |
| 524 | # Check if gh CLI is available |
| 525 | try: |
| 526 | run_cmd("gh --version", capture_output=True) |
| 527 | except subprocess.CalledProcessError: |
| 528 | print("❌ GitHub CLI (gh) is not installed") |
| 529 | print(" Install it from: https://cli.github.com/") |
| 530 | print(f" Then manually create a PR from branch: {branch_name}") |
| 531 | return |
| 532 | |
| 533 | # Check if user is authenticated |
| 534 | try: |
| 535 | run_cmd("gh auth status", capture_output=True) |
| 536 | except subprocess.CalledProcessError: |
| 537 | print("❌ Not authenticated with GitHub CLI") |
| 538 | print(" Run: gh auth login") |
| 539 | print(f" Then manually create a PR from branch: {branch_name}") |
| 540 | return |
| 541 | |
| 542 | pr_title = f"Release v{new_version}" |
| 543 | pr_body = f"""# Release v{new_version} |
| 544 | |
| 545 | {description} |
| 546 | |
| 547 | ## 🚀 Release Workflow |
| 548 | This PR updates the VERSION file to trigger the automated release workflow when merged. |
| 549 | |
| 550 | **What happens after merge:** |
| 551 | 1. ✅ GitHub Actions validates the release |
| 552 | 2. 🏷️ Creates git tag `v{new_version}` |
| 553 | 3. 🏗️ Builds all components (CLI, SDK, Studio) |
| 554 | 4. 📦 Publishes to PyPI and NPM |
| 555 | 5. 📋 Creates GitHub release |
| 556 | |
| 557 | ## 📋 Pre-merge Checklist |
| 558 | - [ ] Release notes are complete and accurate |
| 559 | - [ ] All tests are passing |
| 560 | - [ ] Version bump is correct |
| 561 | - [ ] Ready to publish to production |
| 562 | |
| 563 | /cc @team for review |
| 564 | """ |
| 565 | |
| 566 | try: |
| 567 | # Create the PR |
| 568 | pr_url = run_cmd( |
| 569 | f'gh pr create --title "{pr_title}" --body "{pr_body}"', capture_output=True |
| 570 | ) |
| 571 | |
| 572 | print(f"✅ Pull request created: {pr_url}") |
| 573 | |
| 574 | # Open PR in browser |
| 575 | try: |
| 576 | run_cmd("gh pr view --web", capture_output=True) |
| 577 | except subprocess.CalledProcessError: |