Setup PR Analysis Skill
This skill prepares the local environment for analyzing a bug-fix PR by checking out the parent commit and gathering context.
Usage
Run the setup.sh script with the following parameters:
bash
./setup.sh --pr <number> --issue <number> --repo <owner/repo> --clone-path <path> [--output-dir <path>]
Parameters
| Parameter | Required | Description | Example |
|---|---|---|---|
--pr | Yes | PR number to analyze | 12345 |
--issue | Yes | Linked issue number | 12340 |
--repo | Yes | Repository in owner/repo format | microsoft/vscode |
--clone-path | Yes | Path to local repo clone | /Users/penlv/Code/Work/vscode2 |
--output-dir | No | Directory for context files (default: data/analysis/<pr>) | ./context |
Example
bash
# Setup analysis for PR #12345 linked to issue #12340 ./.github/skills/setup-pr-analysis/setup.sh \ --pr 12345 \ --issue 12340 \ --repo microsoft/vscode \ --clone-path /Users/penlv/Code/Work/vscode2
What It Does
- •Fetches PR details: Gets merge commit, parent commit, PR description, changed files
- •Fetches issue details: Gets issue title, body, and all comments
- •Checks out parent commit: Switches local clone to the state before the fix
- •Generates context files:
- •
issue.md- Issue title, body, and comments - •
pr.md- PR title, body, and commit messages (for fix-validator only) - •
pr-diff.patch- The actual PR diff (for validator comparison) - •
changed-files.txt- List of files changed in the PR (for validator comparison) - •
metadata.json- Structured data for scripts
Output Structure
code
data/analysis/<pr>/ ├── issue.md # Issue context for bug-analyzer ├── pr.md # PR context (fix-validator only) ├── pr-diff.patch # Actual fix (for validator) ├── changed-files.txt # Files touched by the PR └── metadata.json # Structured metadata
Prerequisites
- •
ghCLI installed and authenticated - •
jqfor JSON processing - •Local clone of the repository at the specified path
- •Git access to checkout commits