-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add issue auto-search and resolution verifier to PR review skill #119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -59,9 +59,35 @@ gh pr view NUMBER --json body,title --jq '{title: .title, body: .body}' | |||||||||||||||||||||||||||||||||||||||||||||||||||
| | Yes | No | Extract issue number, proceed to fetch context | | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| | Yes | Yes | Warn the user: "PR has `closes #N` but appears to be partial work — confirm the issue should be closed when this merges" | | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| | No | Yes | OK — no warning needed, this is expected for investigation/partial PRs | | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| | No | No | Warn the user: "PR does not reference a GitHub issue. Consider adding `closes #N` to the PR body if this resolves an issue." | | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| | No | No | **Search for a matching issue** (see below) before warning | | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| **Fetch issue context.** If an issue reference was found (regardless of warnings), fetch the issue for review context. If the PR body used a full URL (`https://github.com/OWNER/REPO/issues/N`), extract both `OWNER/REPO` and `N` and pass `--repo OWNER/REPO` to query the correct repository. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ### Auto-searching for a matching issue | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| When no closing keyword is found and the PR doesn't look like partial/investigation work, **actively search** for a matching issue before giving up: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1. **Search open issues** by PR title keywords and branch name: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Search by key terms from the PR title (strip type prefix like "feat: ") | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| gh issue list --repo OWNER/REPO --state open --search "TITLE_KEYWORDS" --json number,title,labels --jq '.[] | {number, title, labels: [.labels[].name]}' | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Also search recently closed issues (in case PR was created after issue was closed) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| gh issue list --repo OWNER/REPO --state closed --search "TITLE_KEYWORDS" --json number,title,labels --jq '.[] | {number, title, labels: [.labels[].name]}' | head -10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Search by key terms from the PR title (strip type prefix like "feat: ") | |
| gh issue list --repo OWNER/REPO --state open --search "TITLE_KEYWORDS" --json number,title,labels --jq '.[] | {number, title, labels: [.labels[].name]}' | |
| # Also search recently closed issues (in case PR was created after issue was closed) | |
| gh issue list --repo OWNER/REPO --state closed --search "TITLE_KEYWORDS" --json number,title,labels --jq '.[] | {number, title, labels: [.labels[].name]}' | head -10 | |
| # Search by key terms from the PR title (strip type prefix like "feat: ") plus simple terms from the branch name | |
| gh issue list --repo OWNER/REPO --state open --search "TITLE_KEYWORDS BRANCH_NAME_TERMS" --json number,title,labels --jq '.[] | {number, title, labels: [.labels[].name]}' | |
| # Also search recently closed issues (in case PR was created after issue was closed) | |
| gh issue list --repo OWNER/REPO --state closed --search "TITLE_KEYWORDS BRANCH_NAME_TERMS" --json number,title,labels --jq '.[] | {number, title, labels: [.labels[].name]}' | head -10 |
Copilot
AI
Mar 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The closed-issues example uses a | head -10 truncation. Prefer using gh issue list --limit 10 ... so the limit is applied by the CLI (avoids accidental truncation of JSON output and makes the command more portable/explicit).
| gh issue list --repo OWNER/REPO --state closed --search "TITLE_KEYWORDS" --json number,title,labels --jq '.[] | {number, title, labels: [.labels[].name]}' | head -10 | |
| gh issue list --repo OWNER/REPO --state closed --search "TITLE_KEYWORDS" --limit 10 --json number,title,labels --jq '.[] | {number, title, labels: [.labels[].name]}' |
Copilot
AI
Mar 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The candidate-evaluation step includes comparing issue "title/body", but the preceding gh issue list commands only fetch number,title,labels (no body/milestone). To make this actionable/accurate, document fetching each candidate's full details (e.g., gh issue view <n> --json title,body,labels,milestone,comments) before doing the comparison criteria listed here.
| 2. **Evaluate candidates.** For each candidate issue, compare: | |
| 2. **Evaluate candidates.** For each candidate issue, first fetch its full details, then compare: | |
| ```bash | |
| # For each candidate issue number CANDIDATE_N, fetch full context | |
| gh issue view CANDIDATE_N \ | |
| --repo OWNER/REPO \ | |
| --json title,body,labels,milestone,comments |
Then compare:
Copilot
AI
Mar 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The suggested auto-link command gh pr edit ... --body "EXISTING_BODY\n\nCloses #N" is fragile because it requires correctly escaping arbitrary existing PR body content (quotes/backticks/newlines) and can easily corrupt or truncate the body. Consider documenting a safer approach (e.g., write the updated body to a temp file and use gh pr edit --body-file, and ensure the operation is idempotent so you don’t append a duplicate closing line if one is already present).
| - **High confidence** (single strong match, clear title/scope alignment): auto-link the issue by updating the PR body with `gh pr edit NUMBER --body "EXISTING_BODY\n\nCloses #N"`. Inform the user: "Auto-linked closes #N — issue title closely matches this PR." | |
| - **High confidence** (single strong match, clear title/scope alignment): auto-link the issue by **safely updating the PR body**: | |
| 1. Read the existing body into a temp file: | |
| ```bash | |
| tmpfile="$(mktemp)" | |
| gh pr view NUMBER --json body --jq '.body' > "$tmpfile" | |
| ``` | |
| 2. Make the operation **idempotent** by only appending the closing line if it's not already present: | |
| ```bash | |
| if ! grep -q "Closes #N" "$tmpfile"; then | |
| printf '\n\nCloses #N\n' >> "$tmpfile" | |
| fi | |
| ``` | |
| 3. Update the PR using `--body-file` (avoids fragile shell quoting of the existing body): | |
| ```bash | |
| gh pr edit NUMBER --body-file "$tmpfile" | |
| rm "$tmpfile" | |
| ``` | |
| Inform the user: "Auto-linked closes #N — issue title closely matches this PR." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment "# Search by key terms from the PR title (strip type prefix like "feat: ")" implies a specific parsing logic for
TITLE_KEYWORDS. To enhance clarity and ensure consistent behavior, it would be beneficial to explicitly state howTITLE_KEYWORDSare derived from the PR title (e.g., "TITLE_KEYWORDSare extracted by stripping conventional commit type prefixes like "feat:", "fix:", etc., and then tokenizing the remaining title."). This clarifies the expected input for the search.