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


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

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


📝 Exercises

  1. Basic: Configure GitHub integration and have OpenCode review a PR.

  2. Intermediate: Define PR review rules in AGENTS.md, then have OpenCode review by those rules.

  3. Advanced: Integrate OpenCode in GitHub Actions for automated code review.

Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏