@@ -96,22 +96,22 @@ To test locally: |
96 | 96 | MODEL=anthropic/claude-sonnet-4-20250514 \ |
97 | 97 | ANTHROPIC_API_KEY=sk-ant-api03-1234567890 \ |
98 | 98 | 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 |
102 | 102 | ``` |
103 | 103 |
|
104 | 104 | - `MODEL`: The model used by opencode. Same as the `MODEL` defined in the GitHub workflow. |
105 | 105 | - `ANTHROPIC_API_KEY`: Your model provider API key. Same as the keys defined in the GitHub workflow. |
106 | 106 | - `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`. |
110 | 110 |
|
111 | 111 | ### Issue comment event |
112 | 112 |
|
113 | 113 | ``` |
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"}}}' |
115 | 115 | ``` |
116 | 116 |
|
117 | 117 | Replace: |
@@ -125,13 +125,13 @@ Replace: |
125 | 125 | ### Issue comment with image attachment. |
126 | 126 |
|
127 | 127 | ``` |
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 "}}}' |
| 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 "}}}' |
129 | 129 | ``` |
130 | 130 |
|
131 | 131 | 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). |
132 | 132 |
|
133 | 133 | ### PR comment event |
134 | 134 |
|
135 | 135 | ``` |
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"}}}' |
137 | 137 | ``` |