| name | gh-pr-issue |
| description | Keep pull requests and issues healthy using gh CLI (list, view, comment, close). |
When to Use
Invoke this skill when triaging review queues, summarizing checks, or updating GitHub issues. It wraps gh pr and gh issue commands so you can stay on top of reviews without leaving Opencode.
Prerequisites
ghCLI authenticated (gh auth login --scopes repo,workflow).jqinstalled for JSON parsing.- Environment variables (ask for them if absent):
GITHUB_REPOSITORYDEFAULT_BRANCH
Pull Request Procedures
List Pull Requests (/pr-list)
- Command template:
gh pr list --repo "$GITHUB_REPOSITORY" \ --state ${STATE:-open} \ ${LABEL:+--label "$LABEL"} \ ${SEARCH:+--search "$SEARCH"} \ --limit ${LIMIT:-20} \ --json number,title,author,reviewDecision,updatedAt,url - Pipe to
jq '.'. - Highlight numbers, titles, reviewDecision, and last updated timestamps.
View Pull Request (/pr-checks, /pr-open)
- Fetch metadata + checks:
gh pr view "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" \ --json number,title,author,baseRefName,headRefName,isDraft,mergeable,reviewDecision,checks - Summarize failing checks with names, status, and URLs.
- To open in browser, run
gh pr view "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" --web(gh will launch the default browser; echo the URL when possible).
Comment on Pull Request (/pr-comment)
- Ensure a comment body exists; request it if missing.
- Run
gh pr comment "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" --body "$BODY". - Share the resulting comment URL from gh output.
Close / Reopen Pull Request (/pr-close)
- Optional: leave a note explaining why the PR is closing.
- If deleting the branch, append
--delete-branch. - Command:
[ -n "$BODY" ] && gh pr comment "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" --body "$BODY" gh pr close "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" ${DELETE_BRANCH:+--delete-branch} - Report final state.
Issue Procedures
List Issues (/issue-list)
- Command template:
gh issue list --repo "$GITHUB_REPOSITORY" \ --state ${STATE:-open} \ ${LABEL:+--label "$LABEL"} \ ${SEARCH:+--search "$SEARCH"} \ --limit ${LIMIT:-20} \ --json number,title,author,assignees,updatedAt,url - Use
jq '.'and summarize.
View Issue (/issue-view)
- Fetch metadata:
gh issue view "$ISSUE_NUMBER" --repo "$GITHUB_REPOSITORY" \ --json number,title,state,body,labels,assignees,url - Surface body excerpt, labels, assignees, and share the URL.
Comment on Issue (/issue-comment)
- Confirm comment body.
- Run
gh issue comment "$ISSUE_NUMBER" --repo "$GITHUB_REPOSITORY" --body "$BODY". - Return confirmation output.
Close or Reopen Issue (/issue-close, /issue-reopen)
- For closing:
- Optionally comment with context first.
- Run
gh issue close "$ISSUE_NUMBER" --repo "$GITHUB_REPOSITORY".
- For reopening:
- Optionally state the reason.
- Run
gh issue reopen "$ISSUE_NUMBER" --repo "$GITHUB_REPOSITORY".
- Confirm the resulting state.
Safety Checks
- Never mutate PRs/issues outside
GITHUB_REPOSITORY. - Validate required arguments (PR/issue numbers, comment bodies) before running gh commands.
- When summarizing checks, focus on failing or pending contexts to avoid noisy output.