Reusable GitHub Actions for installing and running OpenCode in other repositories.
This repository is licensed under Apache 2.0.
Write this in your CI.yaml
- name: Run OpenCode review
uses: sun-praise/opencode-actions/review@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
# only one is enough.
deepseek-api-key: ${{ secrets.DEEPSEEK_API_KEY }}
zhipu-api-key: ${{ secrets.ZHIPU_API_KEY }}
opencode-go-api-key: ${{ secrets.OPENCODE_GO_API_KEY }}You'll get a automatic reviewer in Chinese.
Or add the skills to your project:
npx skills add sun-praise/opencode-actionsreview: opinionated PR review wrapper with built-in prompt and model defaultsmulti-review: multi-agent parallel code review with coordinator synthesis — runs multiple reviewer personas (quality, security, etc.) in parallel, then synthesizes a unified reportarchitect-review: architecture-level PR review focusing on coupling, layering, and structural concernsfeature-missing: audits PR implementation against linked issue spec to find missing featuresspec-coverage: cross-references project spec/task files against PR implementation to find planned but unimplemented featuresgithub-run-opencode: one-step wrapper for the commonopencode github runworkflowsetup-opencode: installs OpenCode, restores a dedicated cache, and exports the binary pathrun-opencode: runsopencodewith optional retry logic for flaky GitHub network failures
- Linux only
- installer-based bootstrap via
https://opencode.ai/install - cache is best-effort and does not pin an exact OpenCode version
- by default
setup-opencodeignores unrelatedopencodebinaries already present onPATH; setallow-preinstalled: trueonly if you explicitly trust the runner image
Use this when you want the shortest consumer workflow for opencode github run.
| Input | Default | Description |
|---|---|---|
model |
MODEL_NAME, else zhipuai-coding-plan/glm-5.1 |
Exported as MODEL before opencode github run; explicit input still overrides |
fallback-models |
empty | Optional ordered fallback models, filtered by available provider API keys |
model-timeout-seconds |
300 |
Per-model timeout before rotating to the next fallback candidate when fallbacks are configured; 0 disables it |
fallback-on-regex |
timeout regex | Rotate to the next fallback candidate when output matches this regex |
prompt |
built-in PR review template | Exported as PROMPT before opencode github run |
github-token |
empty | Exported as GITHUB_TOKEN before opencode github run |
zhipu-api-key |
empty | Exported as ZHIPU_API_KEY before opencode github run |
deepseek-api-key |
empty | Exported as DEEPSEEK_API_KEY before opencode github run |
opencode-go-api-key |
empty | Exported as OPENCODE_GO_API_KEY before opencode github run |
reasoning-effort |
max |
Reasoning effort level for the model agent (low, medium, high, max) |
enable-thinking |
true |
Enable thinking mode for the model agent |
use-github-token |
true |
Exported as USE_GITHUB_TOKEN before opencode github run |
attempts |
3 |
Total attempts before failing |
retry-profile |
github-network |
Built-in retry preset for common GitHub failures |
timeout-seconds |
600 |
Maximum execution time for opencode github run; 0 disables it |
working-directory |
empty | Optional working directory before running OpenCode |
github-run-opencode also accepts the setup-related inputs from setup-opencode, such as cache, cache-key, install-attempts, install-url, and allow-preinstalled.
Use this when you want the simplest PR review setup.
- built-in
promptreview template (same asgithub-run-opencode) - built-in
MODELresolution: explicitmodelinput, elseMODEL_NAME, elsezhipuai-coding-plan/glm-5.1 - built-in
timeout-secondsdefault:600(10 minutes) - optional ordered
fallback-modelsfor timeout-driven model rotation - still allows overriding any input when needed
When fallback-models is set, the wrapper keeps model as the first choice and only rotates to the next candidate when the current model times out or emits a timeout-like error. Candidates whose provider key is unavailable are skipped automatically.
Use this alongside review to evaluate PR changes from an architecture perspective.
- evaluates coupling, module placement, layering, interface design, and shotgun surgery risks
- reads
AGENTS.md(orCLAUDE.md) for project-specific architecture conventions - shares the same inputs and cache as
review/feature-missing
- name: Run OpenCode architect review
uses: sun-praise/opencode-actions/architect-review@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
zhipu-api-key: ${{ secrets.ZHIPU_API_KEY }}
opencode-go-api-key: ${{ secrets.OPENCODE_GO_API_KEY }}Use this for multi-agent parallel code review with automatic synthesis. Runs multiple reviewer personas in parallel, then a coordinator agent synthesizes a unified report with cross-validation and deduplication.
- built-in personas: quality, security, performance, architecture
- parallel execution on a single runner via Python subprocess
- coordinator synthesis with dedup, cross-validation, and conflict resolution
- supports custom personas via YAML config file
- reviewer redundancy (multiple instances of the same persona)
- name: Run multi-agent review
uses: sun-praise/opencode-actions/multi-review@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
zhipu-api-key: ${{ secrets.ZHIPU_API_KEY }}With custom team:
- name: Run multi-agent review
uses: sun-praise/opencode-actions/multi-review@v2
with:
default-team: "quality:1,security:1,performance:1"
github-token: ${{ secrets.GITHUB_TOKEN }}
zhipu-api-key: ${{ secrets.ZHIPU_API_KEY }}Use this alongside review to audit whether a PR's implementation covers all requirements from the linked issue spec.
- automatically reads the linked issue body as the feature spec via
gh pr view - if no linked issue, extracts requirements from the PR title and body
- classifies gaps by severity: CRITICAL, MEDIUM, LOW
- shares the same inputs and cache as
review/github-run-opencode
- name: Run feature missing audit
uses: sun-praise/opencode-actions/feature-missing@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
zhipu-api-key: ${{ secrets.ZHIPU_API_KEY }}
opencode-go-api-key: ${{ secrets.OPENCODE_GO_API_KEY }}Use this alongside review and feature-missing to audit whether a PR implements everything the project's spec/task files planned.
Unlike feature-missing (which checks PR self-described scope), spec-coverage uses the project's own spec files as the authoritative source of intended scope. This catches cases where a PR implements part of a larger planned feature but skips critical integration steps.
- auto-discovers spec files in
openspec/changes/*/tasks.md,specs/**, and other common locations - intelligently skips bug fixes and minor changes that don't need specs (
无需审计) - reports missing spec files as a CRITICAL gap when a feature PR should have one but doesn't
- cross-references unchecked task items against the PR diff
- checks end-to-end integration (models read at runtime, configs consumed, APIs called)
- classifies gaps by severity: CRITICAL, MEDIUM, LOW
- shares the same inputs and cache as
review/feature-missing
- name: Run spec coverage audit
uses: sun-praise/opencode-actions/spec-coverage@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
zhipu-api-key: ${{ secrets.ZHIPU_API_KEY }}
opencode-go-api-key: ${{ secrets.OPENCODE_GO_API_KEY }}| Action | Scope source | What it catches |
|---|---|---|
review |
PR diff | Code quality, security, bugs |
multi-review |
PR diff (multi-agent) | Quality, security, performance, architecture in parallel |
architect-review |
PR diff + project conventions | Coupling, layering, module placement, structural concerns |
feature-missing |
PR title/body + linked issues | PR self-described scope completeness |
spec-coverage |
Project spec/task files | Full planned scope vs implementation |
| Input | Default | Description |
|---|---|---|
install-url |
https://opencode.ai/install |
Installer URL used to bootstrap OpenCode |
install-dir |
computed | Directory where opencode will be installed |
xdg-cache-home |
computed | Dedicated XDG cache directory |
cache |
true |
Enable actions/cache for install and cache directories |
cache-key |
v1 |
Cache key suffix used to invalidate installer caches |
install-attempts |
3 |
Total installer attempts |
allow-preinstalled |
false |
Reuse an existing trusted opencode already present on PATH |
The internal cache key also includes a hash of install-url, so changing installer sources does not silently reuse an older cache entry.
| Output | Description |
|---|---|
opencode-path |
Resolved absolute path to opencode |
install-dir |
Resolved install directory |
xdg-cache-home |
Resolved XDG cache directory |
cache-hit |
Whether actions/cache restored a hit |
version |
opencode --version output |
| Input | Default | Description |
|---|---|---|
args |
empty | Space-delimited arguments passed to opencode |
working-directory |
empty | Working directory used before invoking OpenCode |
attempts |
1 |
Total attempts before failing |
retry-on-regex |
empty | Retry only when command output matches this regex |
retry-profile |
empty | Built-in retry preset such as github-network |
retry-delay-seconds |
15 |
Base delay used between retries |
opencode-path |
opencode |
Explicit binary path from setup-opencode |
reasoning-effort |
max |
Reasoning effort level for the model agent (low, medium, high, max) |
enable-thinking |
true |
Enable thinking mode for the model agent |
run-opencode intentionally keeps provider secrets and model selection in workflow env: so the action stays generic.
In the common same-job case, setup-opencode already exports opencode to PATH, so you do not need to pass opencode-path into run-opencode.
Public consumers should reference the subdirectory action path:
uses: sun-praise/opencode-actions/review@v2
uses: sun-praise/opencode-actions/multi-review@v2
uses: sun-praise/opencode-actions/architect-review@v2
uses: sun-praise/opencode-actions/feature-missing@v2
uses: sun-praise/opencode-actions/spec-coverage@v2
uses: sun-praise/opencode-actions/github-run-opencode@v2
uses: sun-praise/opencode-actions/setup-opencode@v2
uses: sun-praise/opencode-actions/run-opencode@v2- name: Run OpenCode review
uses: sun-praise/opencode-actions/review@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
zhipu-api-key: ${{ secrets.ZHIPU_API_KEY }}
opencode-go-api-key: ${{ secrets.OPENCODE_GO_API_KEY }}More examples live in examples/.
If you need more control, you can still use setup-opencode and run-opencode directly. For example, pass opencode-path explicitly when reusing a binary from another job or a custom location.
The PR review example intentionally skips forked pull requests because repository secrets are not exposed there by default.
The comment-command example also skips forked pull requests for the same reason.
The comment-command example only allows OWNER, MEMBER, and COLLABORATOR comments to trigger the workflow.
bash tests/test.shThis repository includes a CI workflow that:
- runs
shellcheckon every bundled shell script - runs the local shell-based regression suite
- smoke-tests all actions through
uses: ./setup-opencode,uses: ./run-opencode,uses: ./github-run-opencode,uses: ./review,uses: ./feature-missing,uses: ./spec-coverage, anduses: ./architect-review
- publish immutable releases as
v1.0.0,v1.1.0,v1.1.1, and so on - consumers can pin to
@v1for compatible updates - security-sensitive consumers should pin to a full commit SHA instead of a moving major tag
- this repository updates the repo-wide major tag like
v1when a semver GitHub release is published
- Push the repository publicly.
- Verify
CIpasses onmain. - Create a GitHub release with a semver tag such as
v1.0.0. - Confirm the
Update Major Tagworkflow movedv1to that release. - Use
owner/repo/review@v2for the simplest review setup,owner/repo/architect-review@v2for architecture review,owner/repo/feature-missing@v2for PR scope audit,owner/repo/spec-coverage@v2for spec coverage audit,owner/repo/github-run-opencode@v2for genericgithub run, orowner/repo/setup-opencode@v2plusowner/repo/run-opencode@v2for more control.
The initial release-notes template lives at docs/releases/v1.0.0.md.
argsis parsed as a space-delimited string, so keep complex text in environment variables likePROMPT- the installer is external, so cache invalidation uses
cache-keyinstead of a guaranteed version pin - first version is optimized for GitHub-hosted or Linux self-hosted runners