You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* docs(bot): improve GitHub bot documentation
- Add quick start section with minimal setup
- Document how the bot determines questions vs changes mode
- Add configuration options table with all inputs
- Include best practices for good/bad prompts
- Add security considerations section
- Add troubleshooting guide for common issues
- Document local testing workflow
- List limitations clearly
- Reference examples in the wild
Addresses #478
* fix(docs): correct Pygments lexer and cross-references in bot.md
- Change ```txt to ```text (Pygments recognizes 'text' not 'txt')
- Change cross-references from .md to .rst (matching actual file extensions)
Fixes CI build failure with 7 warnings treated as errors.
* fix(docs): use correct script path in local testing examples
Address Greptile review: Change placeholder /path/to/github_bot.py
to the correct scripts/github_bot.py relative to repo root.
The gptme GitHub bot lets you run gptme directly from GitHub issues and pull requests. Just comment `@gptme <your prompt>` and the bot will respond or make changes.
5
5
6
-
The `gptme-bot` composite action is a GitHub Action that runs `gptme` in response to comments on GitHub issues or pull requests using the format `@gptme <prompt>`. It is designed to be used for tasks that gptme can perform with a one-shot prompt, such as answering questions, running commands and committing their results, creating files or making simple changes/additions (like write tests), and (potentially) automating code reviews.
6
+
## Quick Start
7
7
8
-
## Usage
9
-
10
-
To use the `gptme-bot` composite action in your repo, you need to create a GitHub Actions workflow file that triggers the action in response to comments on issues or pull requests.
11
-
12
-
Here is an example workflow file that triggers the action in response to issue comments:
8
+
Add this workflow to your repository at `.github/workflows/gptme-bot.yml`:
@gptme What does the `compress_context` function in context.py do?
93
+
@gptme Why does this project use SQLite instead of PostgreSQL?
94
+
```
95
+
96
+
**For changes:**
97
+
- Be clear about what you want changed
98
+
- Reference specific files or locations when possible
99
+
- Break complex changes into smaller prompts
100
+
101
+
```text
102
+
@gptme Add a docstring to the compress_context function
103
+
@gptme Add type hints to all functions in utils.py
104
+
@gptme Create a test file for the new feature in this PR
36
105
```
37
106
38
-
The `gptme-bot` action will then run the `gptme` command-line tool with the command specified in the comment, and perform actions based on the output of the tool.
107
+
### Prompts to Avoid
108
+
109
+
- Very complex multi-step changes (break them up)
110
+
- Vague requests ("make this better")
111
+
- Large refactors spanning many files
112
+
113
+
## Security Considerations
114
+
115
+
1.**Allowlist** - Only users on the allowlist can trigger the bot
116
+
2.**Permissions** - The bot has `write-all` permissions, so protect your allowlist
117
+
3.**API Keys** - Store API keys as repository secrets, never in code
118
+
4.**Review Changes** - Always review bot-created PRs before merging
119
+
120
+
## Troubleshooting
121
+
122
+
### Bot doesn't respond
123
+
124
+
1. Check that the user is on the allowlist
125
+
2. Verify the workflow is enabled (Actions tab)
126
+
3. Check the workflow run logs for errors
127
+
4. Ensure API keys are configured as secrets
128
+
129
+
### Bot creates wrong changes
130
+
131
+
1. Be more specific in your prompt
132
+
2. Reference specific files and line numbers
133
+
3. Break complex requests into smaller steps
134
+
135
+
### Authentication errors
136
+
137
+
1. Verify `GITHUB_TOKEN` has necessary permissions
138
+
2. Check that API keys are valid and not expired
139
+
3. Ensure secrets are accessible to the workflow
140
+
141
+
## Local Testing
142
+
143
+
You can test the bot locally before deploying:
144
+
145
+
```bash
146
+
# Clone the repository
147
+
git clone https://github.com/your-org/your-repo
148
+
cd your-repo
149
+
150
+
# Test with a question
151
+
GITHUB_TOKEN=your_token \
152
+
GITHUB_REPOSITORY=your-org/your-repo \
153
+
ANTHROPIC_API_KEY=your_key \
154
+
python scripts/github_bot.py \
155
+
--issue 123 \
156
+
--comment-body "@gptme What is this project?" \
157
+
--dry-run
158
+
159
+
# Test with changes
160
+
GITHUB_TOKEN=your_token \
161
+
GITHUB_REPOSITORY=your-org/your-repo \
162
+
ANTHROPIC_API_KEY=your_key \
163
+
python scripts/github_bot.py \
164
+
--pr 456 \
165
+
--comment-body "@gptme Fix the typo" \
166
+
--workspace . \
167
+
--dry-run
168
+
```
169
+
170
+
## Limitations
171
+
172
+
-**One-shot execution** - The bot runs once per comment, no multi-turn conversation
173
+
-**Timeout** - Commands time out after 2 minutes
174
+
-**Context** - The bot has access to the issue/PR context but limited file context
175
+
-**Complexity** - Works best for simple, well-defined tasks
176
+
177
+
## Examples in the Wild
39
178
40
-
If a question was asked, it will simply reply.
179
+
The gptme project itself uses this bot. See examples:
- Search for "gptme-bot" in closed PRs to see bot-created changes
41
182
42
-
If a request was made it will check out the appropriate branch, install dependencies, run `gptme`, then commit and push any changes made. If the issue is a pull request, the bot will push changes directly to the pull request branch. If the issue is not a pull request, the bot will create a new pull request with the changes.
183
+
## Related
43
184
44
-
The feature was initially introduced in [#16](https://github.com/gptme/gptme/issues/16).
185
+
-[Automation](automation.rst) - Other ways to automate gptme
186
+
-[Server](server.rst) - Running gptme as a service
0 commit comments