Skip to content

Commit ea670d6

Browse files
fix(ci): fix diff extraction for new files, stderr pollution, and api-key check
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
1 parent 791945e commit ea670d6

1 file changed

Lines changed: 6 additions & 12 deletions

File tree

‎.github/workflows/ai-code-review.yml‎

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,12 @@ jobs:
5555
echo "Reviewing: $FILE"
5656
5757
# ── Get per-file diff ──
58-
DIFF=$(git diff "origin/$BASE_REF...HEAD" -- "$FILE" 2>&1) || { echo " [ERROR] git diff failed for $FILE: $DIFF"; continue; }
58+
DIFF=$(git diff "origin/$BASE_REF...HEAD" -- "$FILE" 2>/dev/null) || { echo " [ERROR] git diff failed for $FILE"; continue; }
5959
60-
# ── If empty, try direct comparison (handles new files / special chars) ──
60+
# ── If empty (new file / special chars), show full content ──
6161
if [ -z "$DIFF" ]; then
62-
DIFF=$(git diff "origin/$BASE_REF" HEAD -- "$FILE" 2>&1) || true
63-
fi
64-
65-
# ── If still empty, try showing file content (new file fallback) ──
66-
if [ -z "$DIFF" ]; then
67-
FILE_CONTENT=$(cat "$FILE" 2>/dev/null) || { echo " [SKIP] $FILE — cannot read"; continue; }
68-
LINE_COUNT=$(echo "$FILE_CONTENT" | wc -l)
69-
DIFF="--- /dev/null\n+++ b/$FILE\n@@ -0,0 +1,$LINE_COUNT @@\n$(echo "$FILE_CONTENT" | sed 's/^/+/')"
62+
LINE_COUNT=$(wc -l < "$FILE" 2>/dev/null) || { echo " [SKIP] $FILE — cannot read"; continue; }
63+
DIFF="--- /dev/null\n+++ b/$FILE\n@@ -0,0 +1,$LINE_COUNT @@\n$(cat "$FILE" | sed 's/^/+/')"
7064
fi
7165
7266
# ── Check if binary ──
@@ -94,8 +88,8 @@ jobs:
9488
}')
9589
9690
# ── Check API key ──
97-
if [ -z "$SENSENOVA_API_KEY" ] || [ "$SENSENOVA_API_KEY" = "sk-placeholder" ]; then
98-
echo " [ERROR] SENSENOVA_API_KEY is not set or is placeholder. Skipping review for $FILE."
91+
if [ -z "$SENSENOVA_API_KEY" ] || [[ "$SENSENOVA_API_KEY" != sk-* ]]; then
92+
echo " [ERROR] SENSENOVA_API_KEY is not set or invalid. Skipping review for $FILE."
9993
continue
10094
fi
10195

0 commit comments

Comments
 (0)