-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-pr-delta.sh
More file actions
executable file
·42 lines (36 loc) · 1.19 KB
/
Copy pathtest-pr-delta.sh
File metadata and controls
executable file
·42 lines (36 loc) · 1.19 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
#!/bin/bash
# Test script to verify PR delta calculation works correctly
# This simulates what the GitHub Action does
set -e
echo "Building kaizen..."
go build -o /tmp/kaizen ./cmd/kaizen
echo ""
echo "Analyzing base branch (main)..."
CURRENT_REF=$(git rev-parse HEAD)
git checkout main
/tmp/kaizen analyze --path=. --skip-churn --output=/tmp/base.json
git checkout "$CURRENT_REF"
echo ""
echo "Analyzing head branch (current)..."
/tmp/kaizen analyze --path=. --skip-churn --output=/tmp/head.json
echo ""
echo "Generating PR comment..."
/tmp/kaizen pr-comment --base-analysis=/tmp/base.json --head-analysis=/tmp/head.json
echo ""
echo "Extracting scores..."
python3 -c "
import json
with open('/tmp/base.json') as b, open('/tmp/head.json') as h:
base = json.load(b)
head = json.load(h)
bs = base.get('score_report', {}).get('overall_score', 0)
hs = head.get('score_report', {}).get('overall_score', 0)
delta = hs - bs
print(f'Base score: {bs:.1f}')
print(f'Head score: {hs:.1f}')
print(f'Delta: {delta:+.1f}')
if delta == 0:
print('WARNING: Delta is zero - this suggests the branches have identical code!')
else:
print('SUCCESS: Non-zero delta detected')
"