PR Creation, Review & Update
Create new PRs, view PR details, review comments, and update PR descriptions. Works with either the current Jujutsu bookmark or any GitHub PR URL.
Usage
Viewing a PR
View PR from current bookmark:
bash
bash scripts/get_pr_reviews.sh
View PR from GitHub URL:
bash
bash scripts/get_pr_reviews.sh "https://github.com/owner/repo/pull/123"
Local Bookmark Mode (no arguments) The script will:
- •Find the bookmark on current revision, or traverse parent revisions if needed
- •Search for a PR matching that bookmark/branch name
- •Display the PR details including review comments using
gh pr view
GitHub URL Mode (with URL argument) The script will:
- •Parse the GitHub PR URL to extract the repository and PR number
- •Check if a local copy exists in
~/grafana/directory - •Use
gh pr viewwith the appropriate repository context
Updating a PR
Update PR from current bookmark:
bash
bash scripts/update-pr.sh
Update specific PR by URL:
bash
bash scripts/update-pr.sh "https://github.com/owner/repo/pull/123"
Create new PR:
bash
bash scripts/update-pr.sh --create
Workflow for updating PR descriptions:
- •Find the PR (from current bookmark or provided URL)
- •Show current PR description if exists
- •Gather context from commits using
jj logandjj diff - •Use AskUserQuestion to gather:
- •Why: The reason for the change
- •Issue reference: Related issue number (optional)
- •What: What was changed
- •If issue number provided, fetch issue details using
gh issue view <issue-number>for additional context - •Format description with Why/What sections:
What
[Description of what was changed]markdown## Why [Explanation of the reason for the change] Relates to #[issue-number]
- •Update using
bash scripts/update-pr.sh(reads from stdin)
How It Works
The script uses:
- •
jj logto find bookmarks on current (@), parent (@-), or grandparent (@--) revisions - •
gh pr listto find the PR number for the branch - •
gh pr viewto display full PR details with reviews and comments
Manual Alternative
If needed, you can manually find the bookmark and query GitHub:
bash
# Find bookmark on current or parent revisions jj log -r '@|@-|@--' -T 'bookmarks' # List recent PRs to find the one for your branch gh pr list --state all --limit 10 # View specific PR (local repo) gh pr view <pr-number> # View specific PR from another repo gh pr view <pr-number> --repo owner/repo
Troubleshooting
- •No bookmark found (local mode): The current and parent revisions don't have bookmarks. Use
jj bookmark listandjj bookmark createto add one. - •No PR found (local mode): No PR exists for the branch name. Check if the PR uses a different branch name or hasn't been created yet.
- •Invalid URL format (URL mode): Ensure the URL follows the format
https://github.com/owner/repo/pull/123. - •Repository not found (URL mode): The repository may not exist in
~/grafana/. The script will use--repoflag to query GitHub directly.