MCPcopy Index your code
hub / github.com/TrainLoop/evals / create_pull_request

Function create_pull_request

scripts/release.py:520–582  ·  view source on GitHub ↗

Create pull request using GitHub CLI.

(new_version: str, description: str, branch_name: str)

Source from the content-addressed store, hash-verified

518
519
520def 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
548This PR updates the VERSION file to trigger the automated release workflow when merged.
549
550**What happens after merge:**
5511. ✅ GitHub Actions validates the release
5522. 🏷️ Creates git tag `v{new_version}`
5533. 🏗️ Builds all components (CLI, SDK, Studio)
5544. 📦 Publishes to PyPI and NPM
5555. 📋 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:

Callers 1

mainFunction · 0.85

Calls 1

run_cmdFunction · 0.85

Tested by

no test coverage detected