You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Azure DevOps pipeline task for running [OpenCode](https://opencode.ai)AI agents in your pipeline.
3
+
Azure DevOps pipeline task for running [OpenCode AI](https://opencode.ai)code reviews and automation in your CI/CD pipelines.
4
4
5
-
Run AI powered code reviews on pull requests automatically or mention /opencode in your comment, and opencode will execute tasks within your Azure DevOps pipeline.
5
+
## Features
6
6
7
-
## What it does
7
+
-**Automated Code Review** - Run AI code reviews automatically on every PR update via build validation
8
+
-**Use any Agent** - Define custom [OpenCode agents](https://opencode.ai/docs/agents) for specialized reviews or tasks
9
+
-**Flexible Models** - Use OpenAI, Anthropic, GitHub Copilot, or any OpenCode-supported provider
8
10
9
-
- Run AI powered code reviews on pull requests automatically using review mode and Azure Devops validation builds.
10
-
- Mention `/opencode-review` or `/oc-review` in your PR comment to trigger a code review.
11
-
- Mention `/opencode` or `/oc` in your PR comment, and opencode will execute tasks within your Azure DevOps pipeline.
11
+
## Coming Soon
12
12
13
-
## Install the extension
13
+
-**Comment-Triggered Commands** - Execute AI code review or any command on-demand via PR comments
14
14
15
-
- From Marketplace: install into your organization and add the task `OpenCodeAgent@1` to a pipeline.
15
+
## Quick Start: PR Code Reviews
16
16
17
-
## Code review as PR build validation pipeline
17
+
The recommended setup is to use **review mode**as a PR build validation policy. This automatically reviews every pull request.
18
18
19
-
Run automated AI driven code review on every PR update.
20
-
Create a pipeline with the following YAML and set it as a PR build validation policy:
19
+
### 1. Create a Review Pipeline
21
20
22
21
```yaml
22
+
# Triggered automatically by PR build validation policy
23
23
trigger: none
24
+
24
25
pool:
25
26
vmImage: ubuntu-latest
26
27
@@ -35,95 +36,71 @@ steps:
35
36
echo "##vso[task.prependpath]$HOME/.opencode/bin"
36
37
displayName: Install OpenCode
37
38
38
-
- task: OpenCodeAgent@1
39
-
displayName: OpenCode PR Agent
40
-
inputs:
41
-
mode: review
42
-
pat: "your-personal-access-token"# or use $(System.AccessToken)
43
-
providerID: opencode
44
-
modelID: glm-4.7-free
45
-
```
46
-
47
-
Notes:
48
-
49
-
- Use a PAT with `Code (read and write)` and `Pull Requests (read and write)` scopes. You can also use `$(System.AccessToken)` if the build service identity has the required scopes.
50
-
51
-
## Provide custom review instructions
52
-
53
-
Use the `reviewPrompt` input to customize the review instructions. For example, to focus on security issues:
54
-
55
-
```yaml
56
-
steps:
57
-
- task: OpenCodeAgent@1
58
-
displayName: "OpenCode Security Review"
59
-
inputs:
60
-
mode: "review"
61
-
pat: "$(System.AccessToken)"
62
-
providerID: "anthropic"
63
-
modelID: "claude-sonnet-4"
64
-
reviewPrompt: |
65
-
Review this pull request for security vulnerabilities, focusing on:
66
-
- SQL injection and XSS attacks
67
-
- Hardcoded secrets or API keys
68
-
- Insecure authentication patterns
69
-
- Missing input validation
70
-
71
-
Be strict and flag all potential issues.
72
-
env:
73
-
ANTHROPIC_API_KEY: $(AnthropicApiKey)
39
+
- task: OpenCodeAgent@0
40
+
displayName: Security Review
41
+
inputs:
42
+
mode: review
43
+
agent: code-review # use any available agent
44
+
pat: $(System.AccessToken)
45
+
model: opencode/claude-opus-4-5
46
+
reviewPrompt: | # optional, if not provided, default prompt is used
47
+
Focus on security vulnerabilities:
48
+
- SQL injection and XSS attacks
49
+
- Hardcoded secrets or API keys
50
+
- Insecure authentication/authorization
51
+
- Missing input validation
52
+
- Unsafe deserialization
53
+
env:
54
+
OPENCODE_API_KEY: $(AnthropicApiKey)
55
+
OPENCODE_PERMISSION: '{"bash": "deny"}'
74
56
```
75
57
76
-
The script execution instructions and PR context are always included automatically—you only need to specify what to review.
The task automatically extracts `organization`, `repositoryId`, `pullRequestId`, `threadId`, and `commentId` from this URL. You can override `organization`, `repositoryId`, or `pullRequestId` with explicit inputs if needed.
0 commit comments