Featured image of post opencode-actions - A Code Review Agent

opencode-actions - A Code Review Agent

A GitHub Action built on opencode that provides automated code review and runner execution capabilities, supporting Z.AI, ZHIPU, and OpenCode Go subscriptions.

语速

To make it easier to integrate opencode for code review, I built a GitHub Action repository. Working with opencode to implement this was straightforward.

Currently, it provides two main features: one is review, and the other is using the runner to execute opencode (directly running opencode’s prompts on the runner) to handle other functionalities. For example, modifying code, creating new issues, creating PRs based on issues, etc.

How stable is it?

  • This repository has been validated across multiple projects, and the release version is reliable.
  • However, note that the main branch version is a rapidly iterating version.

How to integrate?

Add the following to your .github/workflows/opencode-review.yml:

1
2
3
4
5
6
7
8
- name: Run OpenCode review
  uses: sun-praise/opencode-actions/review@v1
  with:
    github-token: ${{ secrets.GITHUB_TOKEN }}

    # only one is enough.
    zhipu-api-key: ${{ secrets.ZHIPU_API_KEY }}
    opencode-go-api-key: ${{ secrets.OPENCODE_GO_API_KEY }}

Currently, this action mainly supports Z.AI, ZHIPU, and OPENCODE GO subscriptions. Therefore, if using ZHIPU, simply add your ZHIPU_API_KEY to the project’s secrets. If using the opencode go subscription, you need to add OPENCODE_GO_API_KEY.

Everything else can use the default configuration. The default model is zhipuai-coding-plan/glm-5-turbo. For more configuration requirements, I recommend checking the original repository’s README.

I previously covered this quick review script in my code review article.

Differences

Actually, opencode has its own actions, so why did I build another one?

The differences from the official version are mainly reflected in several aspects:

FeatureUpstream StatusThis Repository
Model default fallbackOnly required inputThree-level fallback (input → MODEL_NAME → hardcoded default)
Provider convenience fieldsNonezhipu-api-key, opencode-go-api-key, etc.
Review prompt templateNoneChinese-formatted review (mergeable/conditionally mergeable/not mergeable)
Retry logicNoneattempts / retry-profile / retry-on-regex / retry-delay
Execution timeoutNonetimeout-seconds
Version checkNoneOPENCODE_MIN_VERSION
Installation retryNoneinstall-attempts
XDG cache cachingOnly caches binCaches both bin + XDG cache

Detailed explanations are available in sun-praise/opencode-actions#29.

Review effectiveness

You can see the results from the repo’s own PR at opencode-actions#30

The effect looks like this:

Future

  • Try integrating gemini cli. Google’s GEM 3.1 PRO model currently offers great value for money, with the highest intelligence per unit.
  • Integrate MCP plugin functionality. If MCP is available during opencode review, it may bring better review results.
  • Integration of commercial plugin features