OpenCode: OpenCode GitHub Integration
Last updated: 2026-08-31
--- title: OpenCode GitHub and GitLab Integration description: Integration with GitHub and GitLab for automated PR review and Issue handling order: 10 lang: en
OpenCode integrates deeply with GitHub and GitLab for automated platform operations.
1. What You Will Learn
- GitHub integration configuration
- GitLab integration configuration
- Automated PR review
- Issue handling
- CI/CD collaboration
2. GitHub Integration
BASH
# Install GitHub App
opencode github install
# Run GitHub automation
opencode github run
Features: PR review, Issue response, code suggestions, workflow triggers.
In TUI:
TEXT
📖 Display only
Review the PR on the current branch and provide suggestions
3. GitLab Integration
Configure Personal Access Token via /connect, select GitLab and enter the token.
Features: MR review, Issue analysis, Pipeline triggers.
In TUI:
TEXT
📖 Display only
Analyze GitLab MR #42 and provide code review comments
4. Automated PR Review Flow
- Code quality and standards
- Potential bugs and edge cases
- Performance issues
- Security vulnerabilities
- Test coverage
Configure review rules in AGENTS.md:
MARKDOWN
## PR Review Rules
- All new functions must have unit tests
- No any type in TypeScript
- Maximum function length: 50 lines
5. CI/CD Integration
BASH
opencode run --model deepseek/deepseek-v4-flash \
"Review code changes in src/ directory, check for security vulnerabilities"
❓ FAQ
Q What GitHub permissions are needed?
A repo (read code, review PRs) and workflow (trigger Actions). Apply minimum privilege principle.
Q Can self-hosted GitLab integrate?
A Yes. Configure a custom baseURL pointing to your GitLab instance.
Q Alice's team uses GitHub, Bob's uses GitLab—both supported?
A Yes. OpenCode supports both with similar configuration.
📖 Summary
- GitHub integration via
opencode github install - GitLab integration via Personal Access Token
- Supports automated PR/MR review and Issue analysis
- Usable in CI/CD pipelines with
opencode run - Define review rules in AGENTS.md
📝 Exercises
-
Basic: Configure GitHub integration and have OpenCode review a PR.
-
Intermediate: Define PR review rules in AGENTS.md, then have OpenCode review by those rules.
-
Advanced: Integrate OpenCode in GitHub Actions for automated code review.