refactor #1

Open
roberto wants to merge 12 commits from feature/refactor-code into main
Showing only changes of commit 73787f6dfa - Show all commits

View File

@@ -8,21 +8,22 @@ jobs:
review:
runs-on: ubuntu-latest
container:
image: python:3.11-bookworm
image: node:20-bookworm
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Show Python
run: python --version
- name: Install system deps (git + curl)
- name: Install system deps + Python 3.11
run: |
apt-get update
apt-get install -y --no-install-recommends git curl ca-certificates
apt-get install -y --no-install-recommends \
git curl ca-certificates \
python3.11 python3.11-venv python3-pip
ln -sf /usr/bin/python3.11 /usr/local/bin/python
python --version
node --version
git --version
curl --version
- name: Checkout
uses: actions/checkout@v4
- name: Create venv and install project
run: |
@@ -53,30 +54,8 @@ jobs:
--head "${{ github.head_ref }}" \
--format json > review.json
- name: Post PR comment with findings
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
let body = '{}';
try { body = fs.readFileSync('review.json', 'utf8'); } catch (e) {
body = JSON.stringify({ error: 'missing-review', message: String(e) });
}
let parsed = {};
try { parsed = JSON.parse(body); } catch (e) {
parsed = { error: 'invalid-json', raw: body };
}
const findings = parsed.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` +
'```json\n' + JSON.stringify(parsed, null, 2) + '\n```\n' +
'</details>';
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: commentBody,
});
# Temporarily remove github-script; it also needs GitHub env
- name: Show result
run: |
ls -la
head -c 2000 review.json || true