> ## Documentation Index
> Fetch the complete documentation index at: https://docs.duckie.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# GitHub

> Connect GitHub to access repositories and issues with Duckie

Connect GitHub to let your agents create issues, search code, and reference pull requests.

## Capabilities

| Capability             | Supported                     |
| ---------------------- | ----------------------------- |
| **Knowledge Source**   | ✓ Search code and issues      |
| **Deployment Trigger** | ✓ Respond to issues/PRs       |
| **Tool Actions**       | ✓ Create issues, add comments |

## Setup

### Connect via OAuth

1. Go to **Settings → Connections** in Duckie
2. Find **GitHub** and click **Connect**
3. You'll be redirected to GitHub
4. Choose which repositories to grant access to
5. Authorize Duckie
6. You'll be redirected back to Duckie

### Repository Access

You can grant access to:

* **All repositories**: Full access to your account/org
* **Select repositories**: Choose specific repos

<Info>
  For organization repositories, an org admin may need to approve the OAuth app.
</Info>

## Using as a Deployment Trigger

Trigger agents based on GitHub activity:

1. Go to **Deploy**
2. Click **Create Deployment**
3. Select your agent
4. Choose **GitHub** as the trigger
5. Configure events:
   * **Issue opened** — New issue filed
   * **Issue comment** — Comment on an issue
   * **PR opened** — New pull request
   * **PR review** — Review submitted

### Use Cases

* **Auto-triage**: Label and assign new issues
* **Answer questions**: Respond to questions in issues
* **PR assistance**: Help with pull request questions

## Available Tools

| Tool                   | Description            |
| ---------------------- | ---------------------- |
| `github_create_issue`  | Create a new issue     |
| `github_add_comment`   | Comment on issue/PR    |
| `github_search_code`   | Search repository code |
| `github_search_issues` | Search issues and PRs  |
| `github_get_issue`     | Get issue details      |
| `github_add_labels`    | Add labels to issue    |

## Tool Examples

### Create Issue from Support Ticket

```
When a customer reports a bug that needs engineering attention:
1. Use @github_create_issue:
   - Repo: your-org/your-repo
   - Title: Bug report: {summary}
   - Body: Include reproduction steps and customer context
   - Labels: ["bug", "support-reported"]
2. Link the GitHub issue in your response
```

### Search for Related Issues

```
When a customer asks about a known issue:
1. Use @github_search_issues: "is:issue {keywords}"
2. If found, share the issue link and status
3. If not found, offer to create one
```

## Using as Knowledge Source

Index GitHub content:

1. Go to **Train → Knowledge**
2. Click **Add Source**
3. Select **GitHub**
4. Choose repositories and content types:
   * **Issues**: Bug reports and discussions
   * **README/Docs**: Documentation files
   * **Code**: Source code (for technical support)

## Best Practices

### For Open Source Projects

Deploy Duckie to help with community support:

* Answer common questions in issues
* Point to documentation
* Help triage new issues

### For Internal Repositories

Use Duckie to bridge support and engineering:

* Create issues from support tickets
* Search for existing bugs
* Track resolution status

### Use Labels Effectively

Create labels for Duckie-related issues:

* `support-reported`
* `needs-triage`
* `documentation`

## Troubleshooting

### "Repository not accessible"

* Verify you granted access to the repository
* For org repos, check if admin approval is needed
* Re-authenticate if permissions changed

### "Cannot create issue"

* Verify you have write access to the repository
* Check that issues are enabled for the repo

### "Search not returning results"

* GitHub search has rate limits
* Try more specific search queries
* Verify the repository is indexed
