init re
This commit is contained in:
19
.github/workflows/ai-review.yml
vendored
19
.github/workflows/ai-review.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
|||||||
ports:
|
ports:
|
||||||
- 11434:11434
|
- 11434:11434
|
||||||
options: >-
|
options: >-
|
||||||
--health-cmd='curl -sSf http://192.168.1.92/:11434/ || exit 1' --health-interval=10s --health-timeout=5s --health-retries=12
|
--health-cmd="curl -sSf http://192.168.1.92:11434/ || exit 1" --health-interval=10s --health-timeout=5s --health-retries=12
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -33,7 +33,6 @@ jobs:
|
|||||||
|
|
||||||
- name: Wait for Ollama
|
- name: Wait for Ollama
|
||||||
run: |
|
run: |
|
||||||
# Wait for Ollama service to be ready
|
|
||||||
for i in $(seq 1 30); do
|
for i in $(seq 1 30); do
|
||||||
if curl -sSf http://192.168.1.92:11434/ >/dev/null 2>&1; then
|
if curl -sSf http://192.168.1.92:11434/ >/dev/null 2>&1; then
|
||||||
echo "ollama ready" && break
|
echo "ollama ready" && break
|
||||||
@@ -44,7 +43,6 @@ jobs:
|
|||||||
- name: (Optional) Pull model into Ollama
|
- name: (Optional) Pull model into Ollama
|
||||||
run: |
|
run: |
|
||||||
. venv/bin/activate
|
. venv/bin/activate
|
||||||
# ignore errors if ollama CLI not available in container; it's optional
|
|
||||||
ollama pull qwen2.5-coder:7b || true
|
ollama pull qwen2.5-coder:7b || true
|
||||||
|
|
||||||
- name: Run ai-reviewer
|
- name: Run ai-reviewer
|
||||||
@@ -59,18 +57,17 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const body = fs.readFileSync('review.json','utf8');
|
let body = '{}';
|
||||||
|
try {
|
||||||
|
body = fs.readFileSync('review.json', 'utf8');
|
||||||
|
} catch (e) {
|
||||||
|
body = JSON.stringify({ error: 'missing-review', message: String(e) });
|
||||||
|
}
|
||||||
let parsed = {};
|
let parsed = {};
|
||||||
try { parsed = JSON.parse(body); } catch (e) { parsed = { error: 'invalid-json', raw: body }; }
|
try { parsed = JSON.parse(body); } catch (e) { parsed = { error: 'invalid-json', raw: body }; }
|
||||||
const findings = parsed.findings || [];
|
const findings = parsed.findings || [];
|
||||||
const summary = findings.length === 0 ? 'AI Reviewer: no findings.' : `AI Reviewer found ${findings.length} findings.`;
|
const summary = findings.length === 0 ? 'AI Reviewer: no findings.' : `AI Reviewer found ${findings.length} findings.`;
|
||||||
const commentBody = `${summary}\n\n<details><summary>Full JSON</summary>\n\n\n\n\
|
const commentBody = `${summary}\n\n<details><summary>Full JSON</summary>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n` + '```json\n' + JSON.stringify(parsed, null, 2) + '\n```\n</details>';
|
||||||
\
|
|
||||||
\n\n\n\\n\\n\n\
|
|
||||||
\n\
|
|
||||||
\n\n\n\n\n\n\n\n\n\
|
|
||||||
\n\`
|
|
||||||
\n\n` + '```json\n' + JSON.stringify(parsed, null, 2) + '\n```\n</details>';
|
|
||||||
await github.rest.issues.createComment({
|
await github.rest.issues.createComment({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
|
|||||||
Reference in New Issue
Block a user