Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions github/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ inputs:
description: "Share the opencode session (defaults to true for public repos)"
required: false

prompt:
description: "Custom prompt to override the default prompt"
required: false

runs:
using: "composite"
steps:
Expand All @@ -27,3 +31,4 @@ runs:
env:
MODEL: ${{ inputs.model }}
SHARE: ${{ inputs.share }}
PROMPT: ${{ inputs.prompt }}
5 changes: 5 additions & 0 deletions packages/opencode/src/cli/cmd/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,11 @@ export const GithubRunCommand = cmd({
}

async function getUserPrompt() {
const customPrompt = process.env["PROMPT"]
if (customPrompt) {
return { userPrompt: customPrompt, promptFiles: [] }
}

const reviewContext = getReviewCommentContext()
let prompt = (() => {
const body = payload.comment.body.trim()
Expand Down
20 changes: 20 additions & 0 deletions packages/web/src/content/docs/github.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ Or you can set it up manually.

- `model`: The model to use with opencode. Takes the format of `provider/model`. This is **required**.
- `share`: Whether to share the opencode session. Defaults to **true** for public repositories.
- `prompt`: Optional custom prompt to override the default behavior. Use this to customize how opencode processes requests.
- `token`: Optional GitHub access token for performing operations such as creating comments, committing changes, and opening pull requests. By default, opencode uses the installation access token from the opencode GitHub App, so commits, comments, and pull requests appear as coming from the app.

Alternatively, you can use the GitHub Action runner's [built-in `GITHUB_TOKEN`](https://docs.github.com/en/actions/tutorials/authenticate-with-github_token) without installing the opencode GitHub App. Just make sure to grant the required permissions in your workflow:
Expand All @@ -98,6 +99,25 @@ Or you can set it up manually.

---

## Custom prompts

Override the default prompt to customize opencode's behavior for your workflow.

```yaml title=".github/workflows/opencode.yml"
- uses: sst/opencode/github@latest
with:
model: anthropic/claude-sonnet-4-5
prompt: |
Review this pull request:
- Check for code quality issues
- Look for potential bugs
- Suggest improvements
```

This is useful for enforcing specific review criteria, coding standards, or focus areas relevant to your project.

---

## Examples

Here are some examples of how you can use opencode in GitHub.
Expand Down