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
3. Store the API keys in secrets. In your organization or project **settings**, expand **Secrets and variables** on the left and select **Actions**. Add the required API keys.
74
72
@@ -82,32 +80,32 @@ To test locally:
82
80
83
81
1. Navigate to a test repo (e.g. `hello-world`):
84
82
85
-
```
86
-
cd hello-world
87
-
```
83
+
```bash
84
+
cd hello-world
85
+
```
88
86
89
87
2. Run:
90
88
91
-
```
92
-
MODEL=anthropic/claude-sonnet-4-20250514 \
93
-
ANTHROPIC_API_KEY=sk-ant-api03-1234567890 \
94
-
GITHUB_RUN_ID=dummy \
95
-
bun /path/to/opencode/packages/opencode/src/index.ts github run \
96
-
--token 'github_pat_1234567890' \
97
-
--event '{"eventName":"issue_comment",...}'
98
-
```
89
+
```bash
90
+
MODEL=anthropic/claude-sonnet-4-20250514 \
91
+
ANTHROPIC_API_KEY=sk-ant-api03-1234567890 \
92
+
GITHUB_RUN_ID=dummy \
93
+
bun /path/to/opencode/packages/opencode/src/index.ts github run \
94
+
--token 'github_pat_1234567890' \
95
+
--event '{"eventName":"issue_comment",...}'
96
+
```
99
97
100
-
- `MODEL`: The model used by opencode. Same as the `MODEL` defined in the GitHub workflow.
101
-
- `ANTHROPIC_API_KEY`: Your model provider API key. Same as the keys defined in the GitHub workflow.
102
-
- `GITHUB_RUN_ID`: Dummy value to emulate GitHub action environment.
103
-
- `/path/to/opencode`: Path to your cloned opencode repo. `bun /path/to/opencode/packages/opencode/src/index.ts` runs your local version of `opencode`.
104
-
- `--token`: A GitHub persontal access token. This token is used to verify you have `admin` or `write` access to the test repo. Generate a token [here](https://github.com/settings/personal-access-tokens).
105
-
- `--event`: Mock GitHub event payload (see templates below).
98
+
- `MODEL`: The model used by opencode. Same as the `MODEL` defined in the GitHub workflow.
99
+
- `ANTHROPIC_API_KEY`: Your model provider API key. Same as the keys defined in the GitHub workflow.
100
+
- `GITHUB_RUN_ID`: Dummy value to emulate GitHub action environment.
101
+
- `/path/to/opencode`: Path to your cloned opencode repo. `bun /path/to/opencode/packages/opencode/src/index.ts` runs your local version of `opencode`.
102
+
- `--token`: A GitHub persontal access token. This token is used to verify you have `admin` or `write` access to the test repo. Generate a token [here](https://github.com/settings/personal-access-tokens).
103
+
- `--event`: Mock GitHub event payload (see templates below).
- `"body":"hey opencode, summarize thread"` with comment body
120
118
121
-
#### Issue comment with image attachment.
119
+
### Issue comment with image attachment.
122
120
123
121
```
124
-
--event '{"eventName":"issue_comment","repo":{"owner":"sst","repo":"hello-world"},"actor":"fwang","payload":{"issue":{"number":4},"comment":{"id":1,"body":"hey opencode, what is in my image "}}}'
122
+
--event '{"eventName":"issue_comment","repo":{"owner":"sst","repo":"hello-world"},"actor":"fwang","payload":{"issue":{"number":4},"comment":{"id":1,"body":"hey opencode, what is in my image "}}}'
125
123
```
126
124
127
125
Replace the image URL `https://github.com/user-attachments/assets/xxxxxxxx` with a valid GitHub attachment (you can generate one by commenting with an image in any issue).
description: Using opencode within GitHub Issues and Pull-Requests
4
+
---
5
+
6
+
opencode integrates directly into your GitHub workflow. Mention `/opencode` in your comment, and opencode will execute tasks within your GitHub Actions runner.
7
+
8
+
---
9
+
10
+
## Features
11
+
12
+
-**Triage Issues**: Ask opencode to look into an issue and explain it to you
13
+
-**Fix and Implement**: Ask opencode to fix an issue or implement a feature. And it will work in a new branch and submits a PR with all the changes.
14
+
-**Secure**: opencode runs inside your GitHub's runners.
15
+
16
+
---
17
+
18
+
## Installation
19
+
20
+
Run the following command in the terminal from your GitHub repo:
21
+
22
+
```bash
23
+
opencode github install
24
+
```
25
+
26
+
This will walk you through installing the GitHub app, creating the workflow, and setting up secrets.
27
+
28
+
---
29
+
30
+
### Manual Setup
31
+
32
+
1. Install the GitHub app https://github.com/apps/opencode-agent. Make sure it is installed on the target repository.
33
+
2. Add the following workflow file to `.github/workflows/opencode.yml` in your repo. Set the appropriate `model` and required API keys in `env`.
3. Store the API keys in secrets. In your organization or project **settings**, expand **Secrets and variables** on the left and select **Actions**. Add the required API keys.
66
+
67
+
---
68
+
69
+
### Inputs
70
+
71
+
-`model`: The model used by opencode. Takes the format of `provider/model` (**required**)
72
+
-`share`: Share the session. Sessions are shared by default for public repos.
73
+
74
+
---
75
+
76
+
### Usage Examples
77
+
78
+
- Explain an issue
79
+
80
+
```bash
81
+
/opencode explain this issue
82
+
```
83
+
84
+
- Fix an issue - opencode will create a PR with the changes.
85
+
86
+
```bash
87
+
/opencode fix this
88
+
```
89
+
90
+
- Review PRs and make changes
91
+
92
+
```bash
93
+
Delete the attachment from S3 when the note is removed /oc
0 commit comments