# GitHub pull request bot

import { Aside, Steps } from '@astrojs/starlight/components';

<Aside type="note" title="Beta">
  Docs Agent is in beta. Contact support@ekline.io to request access.
</Aside>

Start documentation sessions without leaving GitHub. Mention `@ekline-ai` in any pull request comment or review thread, and the bot generates a documentation draft linked to the PR context.

## How it works

When you mention `@ekline-ai` in a PR comment, the bot:

1. Reacts with a :eyes: emoji to acknowledge your request.
2. Posts a reply with a link to the EkLine editor where it creates the draft.
3. Generates documentation based on your prompt and the PR context.
4. Updates the reply with a link to the docs pull request when ready.

The bot works with any type of PR comment. When you mention `@ekline-ai` on a review comment attached to specific code lines, the agent also receives the file path and diff context for those lines.

## Prerequisites

Before you begin, you need:

- An EkLine organization account.
- The [EkLine GitHub App](/agent/github-app-setup/) installed on your organization.
- Docs Agent access enabled for your organization.

## Trigger the bot from a PR comment

<Steps>
1. Open a pull request on a repository where the EkLine GitHub App is installed.

2. Write a comment on the PR that mentions `@ekline-ai` followed by your documentation request.
   ```text
   @ekline-ai Create a migration guide for the database schema changes in this PR.
   ```

3. The bot reacts with :eyes: to confirm it received your request.

4. A reply appears with a link to the EkLine editor session where the documentation is being drafted.

5. Review and edit the draft in the EkLine editor.

6. When the agent finishes, it opens a docs pull request on your configured documentation repository. The bot updates its reply with a link to the docs PR.
</Steps>

## Trigger the bot from a code review comment

For more targeted documentation, mention the bot on specific lines in a code review.

<Steps>
1. Start a review on the pull request, or view the **Files changed** tab.

2. Select the line or lines you want to reference, and add a review comment that mentions `@ekline-ai`.
   ```text
   @ekline-ai Document this new API endpoint, including the request and response schema.
   ```

3. The bot reacts with :eyes: and replies in the review thread.

4. The agent receives the file path and diff hunk for the lines you commented on, along with your prompt.

5. Review the generated draft in the EkLine editor and the resulting docs PR.
</Steps>

<Aside type="tip" title="Use line comments for precision">
Review comments on specific code lines provide the file path and diff context to the agent. Use these when your request relates to a particular code change, such as a new endpoint, configuration option, or function.
</Aside>

## What the bot posts

The bot communicates progress through comments on the pull request:

| Stage | What the bot posts |
|-------|--------------------|
| Request received | :eyes: reaction on your comment |
| Session started | Reply with a link to the EkLine editor |
| Docs PR created | Updated reply with a link to the new documentation pull request |
| Docs PR updated | Updated reply noting that the bot updated the existing docs PR with new changes |
| Error | Reply with an error message describing what went wrong |

If you mention the bot again on the same PR, it resumes the existing session rather than starting a new one.

## Write effective prompts

The quality of your prompt determines the quality of the output. The bot strips the `@ekline-ai` mention and passes the rest of your comment as the prompt.

| Instead of\u2026 | Try\u2026 |
|---------------|--------|
| "document this" | "Create an API reference for the new `/users` endpoint added in this PR" |
| "update docs" | "Update the authentication guide to cover the OAuth flow changes in this PR" |
| "help with docs" | "Write a migration guide for the breaking changes to the config schema" |

**Include specific details:**

- Name the type of documentation you need: API reference, migration guide, tutorial, how-to.
- Reference specific files or changes in the PR.
- Mention existing documentation to update if applicable.
- Give any audience context, such as whether it's for developer docs or an end-user guide.

## Follow-up comments

After the bot creates a docs PR, you can continue the conversation:

- **Comment on the source PR** — Mention `@ekline-ai` again to refine or extend the documentation. The bot resumes the existing session and updates the docs PR.
- **Comment on the docs PR** — Mention `@ekline-ai` on the generated docs PR to request changes to the draft. The agent receives the docs PR context and pushes new commits.

## Troubleshooting

| Issue | Solution |
|-------|----------|
| Bot does not respond | Verify that the EkLine GitHub App is installed on the repository. Check that the GitHub PR integration is enabled for your organization. |
| Bot reacts but does not reply | The agent may be processing your request. Wait up to a minute. If no reply appears, try again or contact support@ekline.io. |
| "Error" reply from the bot | Read the error message for details. Common causes: session conflicts, service unavailability. Try again or contact support. |
| Docs PR not created | The agent creates a PR when it generates file drafts. If your prompt is ambiguous, the agent may not produce files. Give a more specific prompt. |
| Bot responds to the wrong person | The bot responds to any mention of `@ekline-ai` in the PR. Each mention triggers or resumes a session. |

## Next steps

- [Create documentation](/agent/create) — Generate documentation from your codebase, videos, and external sources.
- [Slack bot](/agent/slack-bot) — Create documentation drafts directly from Slack.
- [Integrations](/agent/integrations) — Connect Notion, Linear, Jira, and other tools for richer context.