A test repository for OpenCode's GitHub MCP (Model Context Protocol) integration. This project demonstrates how to use OpenCode as a GitHub Actions bot to assist with issues and pull requests directly from GitHub comments.
github-test/
├── .github/
│ └── workflows/
│ └── opencode.yml # GitHub Actions workflow for OpenCode
└── README.md # This file
- A GitHub repository
- An OpenCode API key (obtain from OpenCode)
- GitHub Actions enabled on your repository
-
Add the workflow file
Copy
.github/workflows/opencode.ymlto your repository. -
Configure the API key
- Go to your repository Settings → Secrets and variables → Actions
- Click "New repository secret"
- Name:
OPENCODE_API_KEY - Value: Your OpenCode API key
-
Grant permissions
Ensure the workflow has the following permissions:
id-token: writecontents: readpull-requests: readissues: read
Trigger OpenCode by commenting on any issue or pull request with:
| Command | Description |
|---|---|
/oc |
Short trigger command |
/opencode |
Full trigger command |
On an issue:
/oc explain what this issue is about
On a pull request:
/opencode review this pull request for potential bugs
With additional context:
/oc summarize the discussion in this thread
| Issue | Solution |
|---|---|
| Workflow doesn't trigger | Ensure comment starts with or contains /oc or /opencode |
| Authentication error | Verify OPENCODE_API_KEY secret is configured correctly |
| Permission denied | Check repository Settings → Actions → General → Workflow permissions |
| Action fails to run | Confirm GitHub Actions is enabled in repository Settings → Actions |
- Add support for custom commands
- Implement response formatting options
- Add label-based filtering
- Support for draft pull requests
- Multi-language support
- Configuration file for custom triggers
See LICENSE for details.