-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (69 loc) · 2.52 KB
/
Copy pathcodequorum.yml
File metadata and controls
82 lines (69 loc) · 2.52 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
name: CodeQuorum Review
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
review:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"
- name: Install dependencies
run: pip install anthropic langgraph python-dotenv requests
- name: Download CodeQuorum
run: |
curl -sO https://raw.githubusercontent.com/suboss87/CodeQuorum/main/cli.py
curl -sO https://raw.githubusercontent.com/suboss87/CodeQuorum/main/agents.py
curl -sO https://raw.githubusercontent.com/suboss87/CodeQuorum/main/graph.py
- name: Run review
id: review
continue-on-error: true
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: python cli.py --path . --format markdown > review.md
- name: Write failure message if review errored
if: steps.review.outcome == 'failure'
run: |
cat > review.md << 'EOF'
## ⚖️ CodeQuorum Review
> Review could not complete. Check that `ANTHROPIC_API_KEY` is set under **Settings → Secrets and variables → Actions**.
EOF
- name: Post or update PR comment
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const body = fs.readFileSync('review.md', 'utf8');
const marker = '<!-- codequorum-review -->';
const fullBody = marker + '\n' + body;
const { data: comments } = await github.rest.issues.listComments({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
});
const existing = comments.find(c => c.body.startsWith(marker));
if (existing) {
await github.rest.issues.updateComment({
comment_id: existing.id,
owner: context.repo.owner,
repo: context.repo.repo,
body: fullBody,
});
} else {
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: fullBody,
});
}