Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/opencode-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: opencode-review

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

jobs:
review:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
pull-requests: read
issues: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
persist-credentials: false

- name: Run OpenCode review
uses: anomalyco/opencode/github@latest
env:
# NOTE: confirm the env var name against `opencode auth login` output
# or models.dev for the `minimax-coding-plan` provider and adjust
# the secret name in repo Settings → Secrets and variables → Actions.
MINIMAX_API_KEY: ${{ secrets.MINIMAX_API_KEY }}
with:
model: minimax-coding-plan/MiniMax-M3
agent: build
prompt: |
Review this pull request:
- Check for code quality issues and Go idiom violations.
- Look for potential bugs, race conditions, or error-handling gaps.
- Suggest concrete improvements with file/line references.
- Flag any security concerns (secret leakage, unsafe parsing, etc.).
36 changes: 36 additions & 0 deletions .github/workflows/opencode.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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
pull-requests: read
issues: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
persist-credentials: false

- name: Run OpenCode
uses: anomalyco/opencode/github@latest
env:
# NOTE: confirm the env var name against `opencode auth login` output
# or models.dev for the `minimax-coding-plan` provider and adjust
# the secret name in repo Settings → Secrets and variables → Actions.
MINIMAX_API_KEY: ${{ secrets.MINIMAX_API_KEY }}
with:
model: minimax-coding-plan/MiniMax-M3
agent: build
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,25 @@ For system-wide installs (`/usr/local/bin`) the replace may hit a read-only file
- `github.com/spf13/viper` - Configuration
- `github.com/google/uuid` - UUID generation

### GitHub Workflow

Two GitHub Actions workflows wire the OpenCode `build` agent into this repo using the official [`anomalyco/opencode/github`](https://opencode.ai/docs/github/) action:

- `.github/workflows/opencode.yml` — triggered when `/opencode` or `/oc` appears in an issue or PR review comment.
- `.github/workflows/opencode-review.yml` — automatically reviews every non-draft PR on open, on each new commit (`synchronize`), on reopen, and when moved out of draft.

A project-level [`opencode.json`](./opencode.json) pins the `minimax-coding-plan` provider and `MiniMax-M3` model so the opencode server started by the action resolves the model reliably (the GitHub runner has no local auth/config to fall back on).

To enable them:

1. Install the [OpenCode GitHub App](https://github.com/apps/opencode-agent) on this repository.
2. Add the provider's API key under *Settings → Secrets and variables → Actions* as `MINIMAX_API_KEY` — that env var name matches the `minimax-coding-plan` provider in [models.dev](https://models.dev/).

Usage:

- Comment `/opencode <instruction>` (or `/oc`) on any issue or PR to invoke the agent.
- Open a PR to get an automatic code review; every new push re-runs the review on the latest diff.

## License

MIT
1 change: 1 addition & 0 deletions docs/features/LOG-FEATS.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@
2026-07-07-10-26 | Renamed project from `opencode-telegram` to `acolyte` (GitHub repo, local folder, Go module path, binary name, workspace dir, OpenCode agent name, install scripts, CI, embedded workspace templates, docs). Clean break, no data migration.
2026-07-07-10-26 | Added timestamped filenames for downloaded Telegram media - new `GenerateTimestampedFilename(dir, ext)` helper in `internal/media/downloader.go` produces UTC-stamped names (`20060102_150405.jpg`) with `_1`/`_2` collision suffixes; `GetFilePath` now takes an extension instead of a filename; removed obsolete `FilenameFromTelegramPath` helper and its test.
2026-07-07-12-11 | Added self-update feature - `acolyte update`/`version` subcommands with SHA256-verified GitHub Releases replacement of the running binary, optional in-process restart, ad-hoc codesign on macOS, and a non-blocking 5s startup outdated-check in `acolyte start` that drops a row into the notifications table. Also extends `.github/workflows/release.yml` to publish a `checksums.txt`.
2026-08-22-21-57 | Added OpenCode GitHub workflow integration - two `.github/workflows/opencode*.yml` files wire the `build` agent into issues/PRs (slash-command trigger on `/opencode` or `/oc`) and trigger automatic code review on PR open and every new commit, using the OpenCode GitHub App + OIDC and `minimax-coding-plan/MiniMax-M3`. README "GitHub Workflow" subsection added.
3 changes: 2 additions & 1 deletion docs/features/OVERVIEW.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ Telegram bot gateway that allows users to interact with an OpenCode AI agent dir
- feat-telegram-agent.md - Custom telegram-agent in opencode.json configuration
- feat-default-prompts.md - Improved default prompts for workspace template files
- feat-notify-mail-cron.md - SQLite-based notification and mail system with scheduler, timezone gating, and runtime config hot-reload
- feat-self-update.md - In-app self-update via GitHub releases with `acolyte update`/`version` and non-blocking startup outdated-check
- feat-self-update.md - In-app self-update via GitHub releases with `acolyte update`/`version` and non-blocking startup outdated-check
- feat-opencode-github-workflow.md - GitHub Actions workflows wiring the OpenCode `build` agent into issues/PRs via `/opencode` slash commands and automatic PR review on open and every new commit
21 changes: 21 additions & 0 deletions docs/features/feat-opencode-github-workflow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Overview

Adds two GitHub Actions workflows that wire the OpenCode `build` agent into the repository using the official `anomalyco/opencode/github` action: a slash-command trigger on `/opencode` or `/oc` in issue/PR comments, and an automatic code review that fires on PR open and every new commit.

# Details

- Adds `.github/workflows/opencode.yml` triggered by `issue_comment` (type `created`) and `pull_request_review_comment` (type `created`); only runs when the comment body contains `/oc` or `/opencode`
- Job uses `ubuntu-latest`, read-only permissions (`contents: read`, `pull-requests: read`, `issues: read`) plus `id-token: write` for OpenCode GitHub App OIDC, and explicitly pins `agent: build` with model `minimax-coding-plan/MiniMax-M3`
- Adds `.github/workflows/opencode-review.yml` triggered by `pull_request` types `[opened, synchronize, reopened, ready_for_review]`; skips drafts via `if: github.event.pull_request.draft == false` so `synchronize` re-runs the same review on every new commit
- Review job uses the same read-only permission set, the same model/agent, and a code-review-focused `prompt` covering code quality, Go idiom violations, bugs/race conditions/error-handling gaps, and security concerns (secret leakage, unsafe parsing)
- Auth uses the OpenCode GitHub App via OIDC; the API key is supplied via `${{ secrets.MINIMAX_API_KEY }}` — the secret name is written for `minimax-coding-plan` and must be verified against `opencode auth login` / models.dev
- Project-level `opencode.json` at the repo root pins the `minimax-coding-plan` provider and `MiniMax-M3` model so the opencode server started by the action resolves the model reliably in the runner (which has no local auth/config to fall back on); this is the same pattern that resolved [opencode#7958](https://github.com/anomalyco/opencode/issues/7958)
- README.md gains a "GitHub Workflow" subsection under Development covering app install, secret naming, slash-command usage, and auto-review behavior
- Workflow files mirror the official opencode docs pattern (`actions/checkout@v4` with `fetch-depth: 1` and `persist-credentials: false`, then `anomalyco/opencode/github@latest`)

# File Paths

- .github/workflows/opencode.yml
- .github/workflows/opencode-review.yml
- opencode.json
- README.md
11 changes: 11 additions & 0 deletions opencode.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"minimax-coding-plan": {
"name": "MiniMax Coding Plan",
"models": {
"MiniMax-M3": {}
}
}
}
}
Loading