GuidesHosting choices

OpenCode GitHub: the repo, /opencode comments and the Action

OpenCode's GitHub repo (anomalyco/opencode), and its /opencode GitHub agent: setup, the workflow, the app's token, who can trigger it, forks, and OpenCode 2.

December 1, 2026The Everpod team
The short answer

OpenCode’s repository is github.com/anomalyco/opencode (MIT licence, about 230,000 stars on December 1, 2026); the old address, sst/opencode, leads to the same repository. Its GitHub integration, the agent you call with /opencode or /oc in an issue or pull request comment, is an OpenCode 1 feature: you set it up with opencode github install, it runs in your own Actions runner through anomalyco/opencode/github@latest, uses a provider API key from your repository secrets, and answers only people with write access. OpenCode 2 has no github command; there you call opencode run from a workflow of your own.

The repository: anomalyco/opencode

The project lives under the anomalyco organisation. Links and install scripts that still say sst/opencode work, because GitHub serves the moved repository at the old name. As read on December 1, 2026, from GitHub’s API: about 230,000 stars and 31,000 forks, MIT licence, and a default branch called dev rather than main, so a link to a file “on main” will not resolve.

Two versions are released from the same repository, and the releases page is easy to misread because of it. The newest release is v2.4.3, from November 29, 2026, but the “Latest” badge sits on v1.19.6, from November 17, so anything that asks GitHub for the latest release gets OpenCode 1. The packages are split the same way:

OpenCode 2OpenCode 1
Newest version
2.4.3 (Nov 29, 2026)1.19.6 (Nov 17, 2026)
npm package
@opencode/cliopencode-ai
Install script
opencode.ai/v2/installopencode.ai/install
Docs
opencode.ai/docsopencode.ai/v1/docs
GitHub agent
Noneopencode github

The README’s first install line is curl -fsSL https://opencode.ai/v2/install | bash; the rest of the install choices, and why the shorter opencode.ai/install gives you version 1, are in installing OpenCode on Linux. The container image, ghcr.io/anomalyco/opencode, is covered in OpenCode in Docker.

The GitHub agent belongs to OpenCode 1

OpenCode’s GitHub page opens with “These are the docs for OpenCode V1.” The version 2 command list has no github and no pr command, and the action itself installs with curl -fsSL https://opencode.ai/install | bash, the script that installs the newest OpenCode 1. A maintainer bot put it plainly on issue #63328 in November 2026:

OpenCode v2 (`@opencode/cli`) is a separate implementation and doesn't have the `opencode github` command or the App flow. In v2 you run `opencode` directly in your own GitHub Actions job, which uses whatever token you give it …
Copied

The same comment says OpenCode 1 “now only gets fixes for critical bugs”, and the project’s free-tier issue adds that “v1 no longer supports free models”. The agent still works with your own provider key, and it is what the docs describe, so the sections below cover it as it stands in 1.19.6; the last section is the version 2 route.

Set up /opencode in issues and pull requests

The quick route is opencode github install, run inside a clone of the repository with OpenCode 1. It opens https://github.com/apps/opencode-agent for you to install the GitHub app, waits for it, asks you to “Select provider” and “Select model”, writes .github/workflows/opencode.yml, and lists the secrets to add in the repository or organisation settings. It ends by suggesting a comment of /oc summarize on an issue.

By hand it is three steps: install the OpenCode Agent app on the repository, add your provider’s key as an Actions secret in the repository or organisation, and commit the workflow. The docs’ version:

# .github/workflows/opencode.yml
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-latest
    permissions:
      id-token: write
      contents: read
    steps:
      - name: Checkout repository
        uses: actions/checkout@v6
        with:
          fetch-depth: 1
          persist-credentials: false

      - name: Run OpenCode
        uses: anomalyco/opencode/github@latest
        env:
          ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
        with:
          model: anthropic/claude-sonnet-5-5
Copied

The key goes in the env block under the variable name your provider uses, and model takes provider/model. A comment-triggered workflow runs only once the file is on the default branch: GitHub’s events reference says an issue_comment “will only trigger a workflow run if the workflow file exists on the default branch.” Then, in an issue or pull request:

OpenCode puts an eyes reaction on the comment while it works. The match is a plain substring, both in the workflow’s if and in OpenCode’s own check, so a comment that mentions a path such as src/ocr.py also starts a run. The mentions input changes the trigger words.

What the app and its token can do

By default nothing in the workflow holds write access to your repository. The job asks GitHub for an OIDC token (that is what id-token: write is for), sends it to https://api.opencode.ai, and gets back a token for the OpenCode Agent app’s installation on your repository, which it uses to comment, push and open pull requests. Without that permission the run stops with “Could not fetch an OIDC token. Make sure to add id-token: write to your workflow permissions.” In 1.19.6 the app token is revoked when the run ends, and commits are made as opencode-agent[bot].

The app’s permissions, as GitHub publishes them: contents, issues and pull requests write; actions and metadata read. It does not have the workflows permission, so a change that touches .github/workflows/ cannot be pushed with its token; git refuses with “refusing to allow a GitHub App to create or update workflow”. The project closed the request to add it as not planned (#63328), pointing at a personal access token with the workflow scope instead.

To skip the app and the token exchange altogether, set use_github_token: true and pass a token yourself. The docs list what that mode needs: the job’s own contents: write, pull-requests: write and issues: write permissions instead of id-token: write, GITHUB_TOKEN in env, the checkout’s default credential persistence left on, and a git user name and email set by you if OpenCode will commit, since it sets them only in the app mode. For a personal access token, store it as a secret and pass it as both GITHUB_TOKEN and the checkout’s token. Which kind of GitHub credential reaches how far is set out in GitHub access for a coding agent.

Who can trigger it, and forks

On every user-triggered event (a comment, a review comment, an issue, a pull request), OpenCode 1.19.6 asks GitHub for the triggering account’s permission on the repository and goes on only for admin or write. Anyone else gets a failed job with:

User <name> does not have write permissions
Copied

So on a public repository a stranger’s /oc comment does not spend your key, though it still starts a job that fails. The same check applies to issues and pull_request workflows, so the docs’ triage and review examples run fully only for issues and pull requests opened by people with write access. Scheduled and manual runs skip the check (“Scheduled workflows run without a user context to permission-check”).

Forks split by event. A pull_request workflow on a fork’s pull request gets, in GitHub’s words, a GITHUB_TOKEN with “read-only permissions” and no secrets, so the review example cannot reach your model key there. A comment is different: issue_comment runs in your repository from your default branch, with your secrets, and when the pull request comes from a fork OpenCode checks out the fork’s branch to work on. A maintainer who types /oc on an outside contributor’s pull request is therefore running the agent, with your key and the app’s write token, over code and text the contributor wrote, any instructions planted in it included. Read the pull request first. Do not switch these workflows to pull_request_target to reach forks: GitHub warns that “Running untrusted code on the pull_request_target trigger may lead to security vulnerabilities.” The Claude Code GitHub Actions guide covers the same split for Anthropic’s action.

Events and inputs

Beyond comments, the action runs on four more events. For an issue opened or edited, a schedule or a manual run, you must give it a prompt; on a pull request opened, synchronised or reopened with no prompt, it uses “Review this pull request”. Scheduled runs work on branches named opencode/schedule-… and report in the logs and in pull requests. Any other event fails with Unsupported event type. The action’s inputs, from its action.yml:

InputWhat it does
model
Required, provider/model
agent
A primary agent; falls back to default_agent, then build
prompt
Replaces the default behaviour
mentions
Trigger words, case-insensitive; default /opencode,/oc
variant
Provider-specific reasoning effort, such as high or minimal
use_github_token
Use the GITHUB_TOKEN you pass instead of the app; default false
oidc_base_url
Token exchange address, only for a custom GitHub app; default https://api.opencode.ai
share
Listed as “Share the opencode session (defaults to true for public repos)”; nothing in 1.19.6’s GitHub code reads it

Two things are fixed rather than chosen: the action always installs the newest OpenCode 1 release, with no version input, and @latest is a moving tag. GitHub’s secure use reference says to “Pin actions to a full-length commit SHA” (where a repository does not lock its workflow dependencies with a lockfile), because “a tag can be moved or deleted if a bad actor gains access to the repository storing the action”, and to check that the SHA “is from the action’s repository and not a repository fork.” Pinning holds the action’s own code still; the OpenCode it installs is still the newest version 1.

OpenCode 2 in GitHub Actions

With version 2 you write the workflow yourself and call opencode run. The commands page says: “In CI, pass a provider API key as a secret and use standalone mode so the private server receives it.” Its example:

name: OpenCode review
on: [pull_request]
jobs:
  review:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npm install --global @opencode/cli
      - run: opencode run --standalone --model anthropic/claude-sonnet-5-5 "Review this repository for correctness and summarize any issues."
        env:
          ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
Copied

This prints its review in the job log; it does not comment, push or check who triggered it. Anything more is yours to add: permissions on the job, a token for gh if the agent should comment or open pull requests, and a condition on the comment author if you trigger it from comments. The fork rules above apply unchanged. A run cannot stop to ask for permission, so it refuses whatever your rules set to ask and carries on, and the exit status does not tell you; running OpenCode headless covers that and the --auto flag (“Auto-approve permissions that are not explicitly denied”), and OpenCode permissions covers writing the rules a job should run under. For the same job with OpenAI’s agent, see Codex and GitHub.

Run OpenCode on an always-on developer pod.

A developer pod is a permanent cloud computer (VPS), set up and secured for you, with your pick of Claude Code, Codex, OpenCode, Pi, Hermes and OpenClaw installed. Run more agents at once than your laptop can hold, and keep them working when it’s closed. From $24 a month, built in about ten minutes.