Skip to content

Pull Request Artifact Generation

Generate pull request artifacts from GitHub PR data.

Overview

The smooth pr generate command fetches pull request data from GitHub and generates:

  • Title: Max 250 characters, descriptive summary of changes
  • Summary: Structured markdown with overview, changes, testing, and documentation sections

When to Use It

  • Generate PR titles and summaries for new pull requests
  • Update existing PR documentation after changes
  • Automate PR documentation in CI/CD workflows

How It Works

  1. Create a PR on GitHub (or use an existing PR)
  2. Run smooth pr generate --pr-number <number>
  3. The system fetches PR data via GitHub API
  4. Artifacts are generated from commits, files, and metadata
  5. Output to stdout or push to GitHub with --push

The system analyzes:

  • All commits in the PR
  • Files changed and file types
  • PR metadata (labels, assignees, base/head branches)
  • Commit messages and patterns
  • Code diff context

Configuration

Configure pull request artifact generation:

# Set default output format
smooth config set defaults.output json

# Set default owner
smooth config set defaults.owner my-org

See Configuration for additional options.

Output Behavior

Artifacts are output to stdout by default:

  • --output text - Plain text output (default)
  • --output json - JSON structured output
  • --push - Update PR title and body on GitHub
  • --title - Generate only title
  • --summary - Generate only summary

Basic Usage

# Auto-detect owner/repo from git remote
smooth pr generate --pr-number 42

# On branch "pr-42" - auto-detects everything
smooth pr generate

Push to GitHub

smooth pr generate --pr-number 42 --push

JSON Output

smooth pr generate --pr-number 42 --output json

Security and Data Handling

Smoothdev encrypts customer data in transit and at rest using tenant-scoped encryption keys. Source data is processed only for the requested operation and is not retained long term. Generated artifacts are returned to the user. Operational metrics and validation logs are retained to improve system reliability and quality.

Limitations

  • Requires valid GitHub token with repo scope for private repositories
  • PR must exist on GitHub before generation (draft PRs supported)
  • Maximum of 250 commits per PR for analysis
  • Large PRs (>500 files changed) may have truncated analysis
  • The --push flag requires repo scope on the GitHub token
  • PR number auto-detection requires branch names matching patterns: pr-<number>, <number>-description

Troubleshooting

Error Cause Resolution
Error fetching PR data Invalid PR number or token Verify PR exists and token is valid
Could not determine owner/repo No git remote Run in git repo or specify --owner --repo
Could not detect PR number Branch name mismatch Use --pr-number explicitly
GitHub API rate limit Too many requests Wait for reset or use authenticated requests

See Also