Skip to content

get-gh-issue

get-gh-issue - fetch GitHub issue data via the GitHub CLI

state-name:
tool: get-gh-issue
arguments:
issue-number: <number>
format: <format> # optional
include-title: <boolean> # optional
include-description: <boolean> # optional
include-comments: <boolean> # optional

The get-gh-issue tool fetches issue details from GitHub using the gh CLI. It automatically detects the repository from the git remote and retrieves the specified issue’s title, body, and comments.

The tool requires the GitHub CLI (gh) to be installed and authenticated.

ArgumentRequiredDefaultDescription
issue-numberYes-GitHub issue number (with or without #)
formatNojsonOutput format: json or markdown
include-titleNotrueInclude issue title
include-descriptionNotrueInclude issue body
include-commentsNotrueInclude issue comments
CodeMeaning
0Success
1General error
2Not in a git repository
3Issue not found
4Access denied (authentication required)
5Rate limit exceeded
6GitHub CLI not installed
7Network or temporary error

JSON format (default) includes all issue fields plus comments array:

{
"number": 123,
"title": "Issue title",
"body": "Issue description...",
"state": "open",
"comments": [
{
"user": {"login": "username"},
"body": "Comment text..."
}
]
}

Markdown format provides human-readable output:

# Issue #123
## Issue title
Issue description...
## Comments
### username
Comment text...
get-issue:
tool: get-gh-issue
arguments:
issue-number: 123
output: var(issue_json)
get-issue:
tool: get-gh-issue
arguments:
issue-number: "#456"
format: markdown
output: file(./issue.md)
get-title:
tool: get-gh-issue
arguments:
issue-number: 789
include-description: false
include-comments: false
output: var(issue_data)
fetch-issue:
tool: get-gh-issue
arguments:
issue-number: "{{ issue_num }}"
output: var(issue)
on-error:
3: issue-not-found
4: auth-required
5: rate-limited
6: gh-not-installed
_: network-error
next: process-issue
issue-not-found:
tool: bash
arguments:
command: 'echo "Issue #{{ issue_num }} not found" >&2 && exit 1'
auth-required:
tool: bash
arguments:
command: |
echo "GitHub authentication required. Run: gh auth login"
exit 1
rate-limited:
tool: bash
arguments:
command: |
echo "GitHub API rate limit exceeded. Authenticate with gh auth login for higher limits."
exit 1
gh-not-installed:
tool: bash
arguments:
command: |
echo "GitHub CLI not found. Install from https://cli.github.com"
exit 1
start-at: fetch-issue
states:
fetch-issue:
tool: get-gh-issue
arguments:
issue-number: "{{ issue_number }}"
format: markdown
output: var(issue_content)
next: analyze
analyze:
tool: claude
arguments:
prompt: |
Analyze this GitHub issue and suggest an implementation approach:
{{ issue_content }}
output: var(analysis)
name: implement-feature
start-at: load-issue
variables:
issue_number: ""
states:
load-issue:
tool: get-gh-issue
arguments:
issue-number: "{{ issue_number }}"
format: markdown
output: file(./context/issue.md)
next: implement
implement:
tool: claude-code
arguments:
prompt: |
Implement the feature described in this issue:
{{ file(./context/issue.md) }}
Terminal window
# macOS
brew install gh
# Linux
# See https://cli.github.com/manual/installation
Terminal window
gh auth login

Follow the prompts to authenticate with GitHub.

The tool detects the repository from git remote get-url origin. Supported formats:

  • HTTPS: https://github.com/owner/repo.git
  • SSH: git@github.com:owner/repo.git
  • bash - For custom gh commands
  • claude - For issue analysis