Skip to content

Commit 2034fab

Browse files
committed
Squashed commit of the following:
commit 7b2ad6a Merge: 74c8539 847a63e Author: Frank <[email protected]> Date: Mon Aug 18 15:31:54 2025 +0800 Merge branch 'dev' into github commit 74c8539 Author: Frank <[email protected]> Date: Mon Aug 18 15:30:14 2025 +0800 sync commit 0d27f8e Author: Frank <[email protected]> Date: Mon Aug 18 14:30:57 2025 +0800 sync commit 0cf7e6c Author: Frank <[email protected]> Date: Mon Aug 18 11:54:57 2025 +0800 sync commit a782cb7 Author: Frank <[email protected]> Date: Mon Aug 18 11:53:25 2025 +0800 sync commit aa55701 Author: Frank <[email protected]> Date: Mon Aug 18 11:48:10 2025 +0800 sync commit 73c8150 Author: Frank <[email protected]> Date: Mon Aug 18 01:29:29 2025 +0800 sync commit c532513 Author: Frank <[email protected]> Date: Mon Aug 18 01:07:48 2025 +0800 sync commit c5b646a Author: Frank <[email protected]> Date: Mon Aug 18 01:02:02 2025 +0800 sync commit 27f7cc8 Author: Frank <[email protected]> Date: Mon Aug 18 00:59:22 2025 +0800 sync commit 0a6152a Author: Frank <[email protected]> Date: Sun Aug 17 18:11:31 2025 +0800 fix /opencode trigger commit f108910 Author: Frank <[email protected]> Date: Sun Aug 17 17:55:14 2025 +0800 sync commit 3ad1824 Author: Frank <[email protected]> Date: Sun Aug 17 17:44:11 2025 +0800 sync commit 24f0f81 Author: Frank <[email protected]> Date: Sun Aug 17 17:18:22 2025 +0800 sync commit bc199d3 Author: Frank <[email protected]> Date: Sun Aug 17 16:59:03 2025 +0800 sync commit 6cf860b Author: Frank <[email protected]> Date: Sun Aug 17 16:54:48 2025 +0800 sync commit f5f753f Author: Frank <[email protected]> Date: Sun Aug 17 14:43:12 2025 +0800 sync commit 26d2e23 Author: Frank <[email protected]> Date: Sun Aug 17 14:33:40 2025 +0800 sync commit c5b3f54 Author: Frank <[email protected]> Date: Sun Aug 17 14:16:10 2025 +0800 sync commit 1c74e9a Author: Frank <[email protected]> Date: Sun Aug 17 08:17:53 2025 +0800 sync commit 89052dc Author: Frank <[email protected]> Date: Sun Aug 17 08:12:43 2025 +0800 sync commit 42931d4 Author: Frank <[email protected]> Date: Sun Aug 17 08:08:37 2025 +0800 sync commit f22e97d Author: Frank <[email protected]> Date: Sun Aug 17 08:01:57 2025 +0800 sync commit 2dda422 Author: Frank <[email protected]> Date: Sun Aug 17 07:55:38 2025 +0800 sync commit b8be1d0 Author: Frank <[email protected]> Date: Sun Aug 17 07:48:18 2025 +0800 sync commit 78c84b9 Author: Frank <[email protected]> Date: Sat Aug 16 20:49:26 2025 +0800 sync commit dd9c0c8 Author: Frank <[email protected]> Date: Sat Aug 16 20:47:25 2025 +0800 sync commit 5eb917a Author: Frank <[email protected]> Date: Sat Aug 16 20:35:48 2025 +0800 sync commit 43cf83e Author: Frank <[email protected]> Date: Sat Aug 16 20:32:49 2025 +0800 sync commit 10673ca Author: Frank <[email protected]> Date: Sat Aug 16 19:55:53 2025 +0800 sync commit c45ae8a Author: Frank <[email protected]> Date: Sat Aug 16 19:53:52 2025 +0800 sync commit 3c329de Author: Frank <[email protected]> Date: Sat Aug 16 19:49:56 2025 +0800 sync commit 5797048 Author: Frank <[email protected]> Date: Sat Aug 16 18:00:04 2025 +0800 sync commit 2741338 Author: Frank <[email protected]> Date: Sat Aug 16 17:54:42 2025 +0800 sync commit a51a8ca Author: Frank <[email protected]> Date: Fri Aug 15 18:59:29 2025 +0800 sync commit f4eeeb6 Author: Frank <[email protected]> Date: Fri Aug 15 18:56:35 2025 +0800 sync commit 1d0509c Author: Frank <[email protected]> Date: Fri Aug 15 18:54:21 2025 +0800 sync commit 339807d Author: Frank <[email protected]> Date: Fri Aug 15 18:49:22 2025 +0800 sync commit 70b4b78 Author: Frank <[email protected]> Date: Fri Aug 15 18:04:57 2025 +0800 sync
1 parent 847a63e commit 2034fab

File tree

10 files changed

+1264
-899
lines changed

10 files changed

+1264
-899
lines changed

github/.gitignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# dependencies (bun install)
2+
node_modules
3+
4+
# output
5+
out
6+
dist
7+
*.tgz
8+
9+
# code coverage
10+
coverage
11+
*.lcov
12+
13+
# logs
14+
logs
15+
_.log
16+
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
17+
18+
# dotenv environment variable files
19+
.env
20+
.env.development.local
21+
.env.test.local
22+
.env.production.local
23+
.env.local
24+
25+
# caches
26+
.eslintcache
27+
.cache
28+
*.tsbuildinfo
29+
30+
# IntelliJ based IDEs
31+
.idea
32+
33+
# Finder (MacOS) folder config
34+
.DS_Store

github/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,22 +96,22 @@ To test locally:
9696
MODEL=anthropic/claude-sonnet-4-20250514 \
9797
ANTHROPIC_API_KEY=sk-ant-api03-1234567890 \
9898
GITHUB_RUN_ID=dummy \
99-
bun /path/to/opencode/packages/opencode/src/index.ts github run \
100-
--token 'github_pat_1234567890' \
101-
--event '{"eventName":"issue_comment",...}'
99+
MOCK_TOKEN=github_pat_1234567890 \
100+
MOCK_EVENT='{"eventName":"issue_comment",...}' \
101+
bun /path/to/opencode/github/index.ts
102102
```
103103

104104
- `MODEL`: The model used by opencode. Same as the `MODEL` defined in the GitHub workflow.
105105
- `ANTHROPIC_API_KEY`: Your model provider API key. Same as the keys defined in the GitHub workflow.
106106
- `GITHUB_RUN_ID`: Dummy value to emulate GitHub action environment.
107-
- `/path/to/opencode`: Path to your cloned opencode repo. `bun /path/to/opencode/packages/opencode/src/index.ts` runs your local version of `opencode`.
108-
- `--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).
109-
- `--event`: Mock GitHub event payload (see templates below).
107+
- `MOCK_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).
108+
- `MOCK_EVENT`: Mock GitHub event payload (see templates below).
109+
- `/path/to/opencode`: Path to your cloned opencode repo. `bun /path/to/opencode/github/index.ts` runs your local version of `opencode`.
110110

111111
### Issue comment event
112112

113113
```
114-
--event '{"eventName":"issue_comment","repo":{"owner":"sst","repo":"hello-world"},"actor":"fwang","payload":{"issue":{"number":4},"comment":{"id":1,"body":"hey opencode, summarize thread"}}}'
114+
MOCK_EVENT='{"eventName":"issue_comment","repo":{"owner":"sst","repo":"hello-world"},"actor":"fwang","payload":{"issue":{"number":4},"comment":{"id":1,"body":"hey opencode, summarize thread"}}}'
115115
```
116116
117117
Replace:
@@ -125,13 +125,13 @@ Replace:
125125
### Issue comment with image attachment.
126126
127127
```
128-
--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 ![Image](https://github.com/user-attachments/assets/xxxxxxxx)"}}}'
128+
MOCK_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 ![Image](https://github.com/user-attachments/assets/xxxxxxxx)"}}}'
129129
```
130130
131131
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).
132132
133133
### PR comment event
134134
135135
```
136-
--event '{"eventName":"issue_comment","repo":{"owner":"sst","repo":"hello-world"},"actor":"fwang","payload":{"issue":{"number":4,"pull_request":{}},"comment":{"id":1,"body":"hey opencode, summarize thread"}}}'
136+
MOCK_EVENT='{"eventName":"issue_comment","repo":{"owner":"sst","repo":"hello-world"},"actor":"fwang","payload":{"issue":{"number":4,"pull_request":{}},"comment":{"id":1,"body":"hey opencode, summarize thread"}}}'
137137
```

github/action.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,15 @@ branding:
66

77
inputs:
88
model:
9-
description: "Model to use"
9+
description: "The model to use with opencode. Takes the format of `provider/model`."
1010
required: true
1111

1212
share:
13-
description: "Share the opencode session (defaults to true for public repos)"
13+
description: "Whether to share the opencode session. Defaults to true for public repositories."
14+
required: false
15+
16+
token:
17+
description: "Optional GitHub access token for performing operations such as creating comments, committing changes, and opening pull requests. Defaults to the installation access token from the opencode GitHub App."
1418
required: false
1519

1620
runs:
@@ -20,10 +24,20 @@ runs:
2024
shell: bash
2125
run: curl -fsSL https://opencode.ai/install | bash
2226

27+
- name: Install bun
28+
shell: bash
29+
run: npm install -g bun
30+
31+
- name: Install dependencies
32+
shell: bash
33+
run: |
34+
cd ${GITHUB_ACTION_PATH}
35+
bun install
36+
2337
- name: Run opencode
2438
shell: bash
25-
id: run_opencode
26-
run: opencode github run
39+
run: bun ${GITHUB_ACTION_PATH}/index.ts
2740
env:
2841
MODEL: ${{ inputs.model }}
2942
SHARE: ${{ inputs.share }}
43+
TOKEN: ${{ inputs.token }}

0 commit comments

Comments
 (0)