-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Expand file tree
/
Copy pathcode-review-pipeline.osop.yaml
More file actions
100 lines (91 loc) · 2.97 KB
/
code-review-pipeline.osop.yaml
File metadata and controls
100 lines (91 loc) · 2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# Semantic Kernel Automated Code Review — OSOP Portable Workflow
#
# AI-powered PR review: fetch the diff, analyze complexity and patterns
# in parallel, generate a structured review, post comments on GitHub,
# and request changes if critical issues are found.
#
# Run with Semantic Kernel or validate: osop validate semantic-kernel-code-review.osop.yaml
osop_version: "1.0"
id: "semantic-kernel-code-review"
name: "Automated Code Review"
description: "Fetch PR diff → parallel analysis → generate review → post comments."
version: "1.0.0"
tags: [semantic-kernel, code-review, github, llm, devtools]
nodes:
- id: "fetch_diff"
type: "api"
subtype: "rest"
name: "Fetch PR Diff"
description: "Pull the diff and file list from the GitHub PR API."
config:
url: "https://api.github.com/repos/{owner}/{repo}/pulls/{number}"
- id: "analyze_complexity"
type: "agent"
subtype: "llm"
name: "Analyze Complexity"
description: "Measure cyclomatic complexity, function length, and nesting depth."
config:
model: "gpt-4o"
plugins: [code_analysis]
- id: "check_patterns"
type: "agent"
subtype: "llm"
name: "Check Patterns & Security"
description: "Scan for anti-patterns, SQL injection, hardcoded secrets, and OWASP issues."
config:
model: "gpt-4o"
plugins: [security_scanner, pattern_matcher]
- id: "check_tests"
type: "agent"
subtype: "llm"
name: "Check Test Coverage"
description: "Verify new code paths have corresponding test cases."
- id: "generate_review"
type: "agent"
subtype: "llm"
name: "Generate Review"
description: "Synthesize all analysis into a structured review with severity levels."
config:
output_schema:
summary: "string"
issues: [{ file: "string", line: "int", severity: "string", message: "string" }]
verdict: "approve | request_changes"
- id: "post_comments"
type: "api"
subtype: "rest"
name: "Post Review Comments"
description: "Submit inline comments and overall review via GitHub API."
config:
url: "https://api.github.com/repos/{owner}/{repo}/pulls/{number}/reviews"
- id: "request_changes"
type: "api"
subtype: "rest"
name: "Request Changes"
description: "Mark the PR as 'changes requested' when critical issues are found."
edges:
- from: "fetch_diff"
to: "analyze_complexity"
mode: "parallel"
- from: "fetch_diff"
to: "check_patterns"
mode: "parallel"
- from: "fetch_diff"
to: "check_tests"
mode: "parallel"
- from: "analyze_complexity"
to: "generate_review"
mode: "sequential"
- from: "check_patterns"
to: "generate_review"
mode: "sequential"
- from: "check_tests"
to: "generate_review"
mode: "sequential"
- from: "generate_review"
to: "post_comments"
mode: "sequential"
- from: "generate_review"
to: "request_changes"
mode: "conditional"
when: "verdict == 'request_changes'"
label: "Critical issues found"