OpenCode GitHub Integration
Use Zeldoc.ai inside GitHub issues and pull requests with OpenCode's GitHub
integration. Mention /opencode or /oc in
a comment and OpenCode will execute tasks on a GitHub Actions runner using the
Zeldoc.ai model.
What you can do
- Triage issues — Ask OpenCode to read an issue and explain it.
- Fix and implement — Ask OpenCode to fix a bug or implement a feature. It works in a new branch and opens a pull request with the changes.
- Review PRs — Comment on a pull request or on specific lines of code and OpenCode will respond with context-aware suggestions.
Prerequisites
- A GitHub repository with admin access (to add secrets and workflows)
- A Zeldoc.ai API key — see Generate an API key
Setup
1. Add the workflow file
Create .github/workflows/opencode.yml in your repository:
name: opencode
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
jobs:
opencode:
if: |
contains(github.event.comment.body, '/oc') ||
contains(github.event.comment.body, '/opencode')
runs-on: ubuntu-24.04
permissions:
id-token: write
contents: write
pull-requests: write
issues: write
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 20
persist-credentials: true
- name: Configure git identity
run: |
git config --global user.email "[email protected]"
git config --global user.name "opencode"
- name: Run OpenCode
uses: anomalyco/opencode/github@latest
env:
ZELDOC_API_KEY: ${{ secrets.ZELDOC_API_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
model: zeldoc/zdev
use_github_token: true
opencode.json provider config?Zeldoc.ai is a built-in OpenCode provider, so the GitHub Action recognizes
zeldoc/zdev without any extra config. You only need to provide the
ZELDOC_API_KEY environment variable — OpenCode picks it up automatically.
2. Add the API key as a secret
- Go to your repository Settings → Secrets and variables → Actions.
- Click New repository secret.
- Name it
ZELDOC_API_KEYand paste your Zeldoc.ai API key as the value. - Click Add secret.
Your API key grants access to your Zeldoc.ai account. Never commit it to version control or share it. GitHub secrets are encrypted and never exposed in logs.
3. Try it out
Leave a comment on any issue or pull request:
/opencode explain this issue
OpenCode will read the issue thread and reply with an explanation. For more examples, see Usage.
Configuration options
The workflow with block supports several options:
| Option | Description | Required |
|---|---|---|
model | The model to use, in provider/model-id format. | Yes |
agent | The agent to use. Falls back to default_agent from config. | No |
prompt | Custom prompt to override the default behavior. | No |
share | Whether to share the session. Defaults to true for public repos. | No |
use_github_token | Use GITHUB_TOKEN instead of the OpenCode App token exchange. | No |
For Zeldoc.ai, always set model: zeldoc/zdev and use_github_token: true.
Usage
Explain an issue
Comment on a GitHub issue:
/opencode explain this issue
OpenCode reads the entire thread and replies with a clear explanation.
Fix an issue
/opencode fix this
OpenCode creates a new branch, implements the fix, and opens a pull request.
Review or change code in a PR
Comment on a pull request:
Delete the attachment from S3 when the note is removed /oc
OpenCode implements the change and commits it to the same PR.
Review specific lines
Leave a comment directly on code lines in the PR's Files tab:
/oc add error handling here
OpenCode receives the file path, line numbers, and diff context for a targeted response.
Supported events
The workflow above triggers on issue and PR comments. You can also configure OpenCode for other GitHub events:
| Event | Trigger | Notes |
|---|---|---|
issue_comment | Comment on an issue or PR | Mention /opencode or /oc. |
pull_request_review_comment | Comment on PR code lines | OpenCode gets file, line, and diff context. |
issues | Issue opened or edited | Requires a prompt input. |
pull_request | PR opened, synced, or reopened | Useful for automated reviews. |
schedule | Cron-based schedule | Requires a prompt input. |
workflow_dispatch | Manual trigger from Actions tab | Requires a prompt input. |
Automated PR review example
name: opencode-review
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
jobs:
review:
runs-on: ubuntu-24.04
permissions:
id-token: write
contents: read
pull-requests: read
issues: read
steps:
- uses: actions/checkout@v5
with:
persist-credentials: true
- name: Configure git identity
run: |
git config --global user.email "[email protected]"
git config --global user.name "opencode"
- uses: anomalyco/opencode/github@latest
env:
ZELDOC_API_KEY: ${{ secrets.ZELDOC_API_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
model: zeldoc/zdev
use_github_token: true
prompt: |
Review this pull request:
- Check for code quality issues
- Look for potential bugs
- Suggest improvements
Scheduled task example
name: Scheduled OpenCode Task
on:
schedule:
- cron: "0 9 * * 1" # Every Monday at 9am UTC
jobs:
opencode:
runs-on: ubuntu-24.04
permissions:
id-token: write
contents: write
pull-requests: write
issues: write
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
persist-credentials: true
- name: Configure git identity
run: |
git config --global user.email "[email protected]"
git config --global user.name "opencode"
- name: Run OpenCode
uses: anomalyco/opencode/github@latest
env:
ZELDOC_API_KEY: ${{ secrets.ZELDOC_API_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
model: zeldoc/zdev
use_github_token: true
prompt: |
Review the codebase for any TODO comments and create a summary.
If you find issues worth addressing, open an issue to track them.
For issues, schedule, and workflow_dispatch events, the prompt input is
required because there is no comment to extract instructions from.