Skip to content
Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

opencode-action

Run an OpenCode agent from GitHub issue and pull request comments.

CI

Quick start

1. Add a provider secret

In Settings → Secrets and variables → Actions, add the API key for your model provider. The example below uses OPENCODE_API_KEY.

2. Add the workflow

Create .github/workflows/opencode.yml:

---
name: OpenCodeon:
issue_comment:
types: [created]pull_request_review_comment:
types: [created]permissions:
contents: writeissues: writepull-requests: writeid-token: writejobs:
opencode:
if: contains(github.event.comment.body, '/oc') || contains(github.event.comment.body, '/opencode')runs-on: ubuntu-lateststeps:
- name: Checkout repositoryuses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1with:
persist-credentials: false
- name: Run OpenCodeuses: dceoy/opencode-action@e5a3599d8b64f9adda6a03a18c8b0b9d077ffebb # v0.7.0env:
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}GITHUB_TOKEN: ${{ github.token }}with:
model: opencode-go/kimi-k3

3. Comment on an issue or pull request

/opencode explain this issue

The shorter /oc trigger also works:

/oc fix this

The default setup exchanges the workflow OIDC token for an OpenCode GitHub App token, which requires id-token: write.

Reusable workflows

For smaller caller workflows, this repository provides reusable workflows for the mention bot and pull request reviews:

WorkflowPurpose
opencode-bot.ymlRun OpenCode from trusted issue or pull request comments, or from a fixed prompt.
opencode-review.ymlRun the bundled /review-pr flow for pull_request events.

See Reusable workflows for caller examples, inputs, secrets, and permission requirements.

Models and secrets

Set model to a provider/model value and pass the corresponding API key:

ProviderExample modelSecret
OpenCodeopencode-go/kimi-k3OPENCODE_API_KEY
OpenRouteropenrouter/openrouter/freeOPENROUTER_API_KEY
Anthropicanthropic/claude-opus-5ANTHROPIC_API_KEY
OpenAIopenai/gpt-5.6-solOPENAI_API_KEY
Custom providermyprovider/my-modelProvider-specific

The provider account must have sufficient credits or quota. For providers not built into OpenCode, see Custom providers.

Sakura AI Engine model synchronization

The optional Sakura model synchronization workflow discovers chat-capable Sakura AI Engine models and opens or updates a pull request when the catalog changes. Configure the SAKURA_AI_ENGINE_API_KEY repository secret before enabling it.

The workflow uses the repository-provided GITHUB_TOKEN with contents: write and pull-requests: write; no additional GitHub token secret is required. GitHub does not create new workflow runs for events triggered by GITHUB_TOKEN, so pull requests created by this workflow do not automatically trigger pull_request workflows. See GitHub's GITHUB_TOKEN documentation.

Inputs

InputDefaultDescription
modelRequiredModel in provider/model format.
agentbuildPrimary agent. A slash command can override it.
promptEvent commentFixed prompt to use instead of the triggering comment.
mentions/opencode,/ocComma-separated trigger phrases.
variant-Provider-specific reasoning effort; leave empty unless supported. See Custom providers.
sharefalseShare the OpenCode session.
use-github-tokenfalseUse the workflow token instead of the default App-token flow.
opencode-versionlatestOpenCode version to install. /review-pr requires 1.2.14+; the bundled Sakura provider's chunkTimeout needs 1.2.25+ (older pins fall back to the request timeout).
use-bundled-toolkittrueUse the bundled agents, commands, skills, and configuration.
timeout-minutes60Stop OpenCode after this many minutes.
oidc-base-urlhttps://api.opencode.aiOIDC exchange URL for a custom GitHub App installation.

When use-github-token: true, keep GITHUB_TOKEN in env and grant only the permissions needed for the task.

Outputs are opencode-version and cache-hit. cache-hit is empty on review-only runs (prompt: /review-pr), which always skip the cache and install fresh.

Pull request reviews

Set prompt: /review-pr to run the bundled read-only review through a dedicated permission-constrained primary agent. The command loads the internal pr-review skill, which builds a change/risk map, dispatches fresh read-only child sessions, independently validates candidate findings, and posts confirmed findings inline when they can be anchored to changed lines. Use /review-pr rather than loading pr-review directly when the enforced read-only boundary is required.

An unscoped review creates a small set of dynamic, risk-driven discovery tasks instead of routing to fixed specialist agents. Explicit aspects such as security, tests, docs, performance, or simplify constrain the selected review lenses. Discovery and validation run in separate fresh child sessions; the current OpenCode v1-compatible implementation uses one hidden review-worker definition for those sessions.

See Pull request reviews for setup, supported review aspects, submission behavior, and security guarantees.

About

OpenCode GitHub agent in GitHub Actions

Topics

Resources

Stars

16 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages