GitHubIssueViewer
Fetch a GitHub issue and its comments as Haystack Document objects—ideal for AI agents that need to read and reason about issue content before taking action.
Key Features
- Returns the issue body as the first document and each comment as a subsequent document.
- Parses the repository owner, name, and issue number directly from the issue URL.
- Stores rich metadata on each document: title, number, state, author, timestamps, and URL.
- Resolves a
GITHUB_TOKENsecret at runtime for authenticated requests (rate-limit friendly). - Works without a token for public repositories.
- Also available as
GitHubIssueViewerToolfor use with Haystack agents.
Configuration
- Optionally, store your GitHub personal access token as a secret named
GITHUB_TOKEN. For instructions, see Create Secrets. - Drag the
GitHubIssueViewercomponent onto the canvas from the Component Library. - Click on the component to open the configuration panel.
- If your repository is private, set
github_tokento theGITHUB_TOKENsecret.
Connections
GitHubIssueViewer receives a url (the full GitHub issue URL). It outputs a documents list where the first document contains the issue body and subsequent documents contain comments. Connect the output to a prompt builder, ranker, or any component that accepts a list of documents.
Source Code
To check this component's source code, open issue_viewer.py in the Haystack Core Integrations repository.
Usage Examples
Basic Configuration
GitHubIssueViewer:
type: haystack_integrations.components.connectors.github.issue_viewer.GitHubIssueViewer
init_parameters:
github_token:
type: env_var
env_vars:
- GITHUB_TOKEN
strict: false
raise_on_failure: true
retry_attempts: 2
Using the Component in a Pipeline
This example shows a pipeline where an agent reads a GitHub issue and drafts a comment in response.
# haystack-pipeline
components:
issue_viewer:
type: haystack_integrations.components.connectors.github.issue_viewer.GitHubIssueViewer
init_parameters:
github_token:
type: env_var
env_vars:
- GITHUB_TOKEN
strict: false
retry_attempts: 2
prompt_builder:
type: haystack.components.builders.chat_prompt_builder.ChatPromptBuilder
init_parameters:
template:
- role: user
content: "Summarize this GitHub issue and its comments:\n\n{% for doc in documents %}{{ doc.content }}\n\n{% endfor %}"
required_variables:
- documents
llm:
type: haystack.components.generators.chat.openai.OpenAIChatGenerator
init_parameters:
model: gpt-4o-mini
connections:
- sender: issue_viewer.documents
receiver: prompt_builder.documents
- sender: prompt_builder.prompt
receiver: llm.messages
inputs:
query:
- issue_viewer.url
outputs:
replies: llm.replies
max_runs_per_component: 100
metadata: {}
Parameters
Inputs
| Parameter | Type | Description |
|---|---|---|
url | str | Full GitHub issue URL (for example, https://github.com/owner/repo/issues/123). |
Outputs
| Parameter | Type | Description |
|---|---|---|
documents | List[Document] | List of documents. The first document contains the issue body; subsequent documents contain the issue comments. |
Init Parameters
These are the parameters you can configure in Pipeline Builder:
| Parameter | Type | Default | Description |
|---|---|---|---|
github_token | Optional[Secret] | None | GitHub personal access token used for API authentication. Not required for public repositories. |
raise_on_failure | bool | True | If True, raises an exception on API errors. If False, returns an error document. |
retry_attempts | int | 2 | Number of retry attempts for failed API requests. |
Related Information
Was this page helpful?