Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

GitHub Run OpenCode

Part of sun-praise/opencode-actions — convenience action that bundles setup-opencode plus opencode github run. Use it when you want the shortest consumer workflow for opencode github run without giving up setup / cache controls. Linux runners only.

Quick start

- name: Run OpenCode
  uses: sun-praise/opencode-actions/github-run-opencode@v3
  with:
    github-token: ${{ secrets.GITHUB_TOKEN }}
    zhipu-api-key: ${{ secrets.ZHIPU_API_KEY }}
    opencode-go-api-key: ${{ secrets.OPENCODE_GO_API_KEY }}
    litellm-url: ${{ secrets.LITELLM_URL }}
    litellm-api-key: ${{ secrets.LITELLM_API_KEY }}

What it does

  • Installs and caches OpenCode (delegates to setup-opencode)
  • Cleans up oversized opencode.db before running (prevents migration failures on self-hosted runners)
  • Auto-recovers from SQLite migration errors by deleting the stale database and retrying
  • Runs opencode github run with optional retry logic for flaky GitHub network failures
  • Skips forked pull requests by default (no secrets exposed)
  • English / Chinese output controlled by the language input

Inputs

Input Default Description
model MODEL_NAME env, else zhipuai-coding-plan/glm-5.1 Exported as MODEL before opencode github run
fallback-models empty Optional ordered fallback models, filtered by available provider keys
model-timeout-seconds 300 Per-model timeout before rotating to the next fallback candidate; 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
zhipu-api-key empty Exported as ZHIPU_API_KEY
opencode-go-api-key empty Exported as OPENCODE_GO_API_KEY
deepseek-api-key empty Exported as DEEPSEEK_API_KEY
minimax-api-key empty Exported as MINIMAX_API_KEY
xiaomi-api-key empty Exported as XIAOMI_API_KEY
litellm-url empty Base URL for LiteLLM proxy endpoint
litellm-api-key empty API key for LiteLLM provider (exported as LITELLM_API_KEY)
reasoning-effort max Reasoning effort 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
language zh Response language: zh or en
extra-env empty Extra environment variables (multi-line KEY=VALUE pairs)
extra-env-allow-sensitive false Allow extra-env to override sensitive runtime variables (with warning)
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
cleanup-db true Delete opencode.db if it exceeds size threshold before running; "true" (50MB default), a number for custom MB threshold, "0" or "false" to disable. Note: db-path is validated against system directories; on macOS /var resolves to /private/var and is allowed
db-path empty Custom path to opencode.db; defaults to ~/.local/share/opencode/opencode.db

All setup-related inputs from setup-opencode (install-url, install-dir, xdg-cache-home, cache, cache-key, install-attempts, allow-preinstalled, version) are also accepted.

Related actions in this monorepo

See the root README for the full list of inputs and examples.

License

Apache 2.0