Skip to content

Commit fb4a9d0

Browse files
committed
ci: add AI code review and doc auto-update workflows
1 parent 6cb65f4 commit fb4a9d0

2 files changed

Lines changed: 90 additions & 0 deletions

File tree

.github/workflows/ai-review.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: AI Code Review
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, ready_for_review]
6+
workflow_dispatch:
7+
inputs:
8+
pr_number:
9+
description: "PR number to review"
10+
required: true
11+
type: number
12+
agents:
13+
description: "Number of agents (1-5)"
14+
required: false
15+
default: "3"
16+
type: choice
17+
options: ["1", "2", "3", "4", "5"]
18+
19+
concurrency:
20+
group: ai-review-${{ github.event.pull_request.number || github.event.inputs.pr_number }}
21+
cancel-in-progress: true
22+
23+
jobs:
24+
review:
25+
runs-on: ubuntu-latest
26+
if: github.event.pull_request.draft == false || github.event_name == 'workflow_dispatch'
27+
28+
permissions:
29+
contents: read
30+
pull-requests: write
31+
32+
steps:
33+
- uses: actions/checkout@v4
34+
with:
35+
fetch-depth: 0
36+
37+
- uses: actions/setup-python@v5
38+
with:
39+
python-version: "3.11"
40+
41+
- name: Install ai-code-reviewer
42+
run: pip install git+https://github.com/calimero-network/ai-code-reviewer.git
43+
44+
- name: Determine PR number and agent count
45+
id: pr
46+
run: |
47+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
48+
echo "number=${{ github.event.inputs.pr_number }}" >> $GITHUB_OUTPUT
49+
echo "agents=${{ github.event.inputs.agents }}" >> $GITHUB_OUTPUT
50+
else
51+
echo "number=${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
52+
echo "agents=3" >> $GITHUB_OUTPUT
53+
fi
54+
55+
- name: Run AI Code Review
56+
env:
57+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
58+
GITHUB_TOKEN: ${{ secrets.GH_PAT || secrets.GITHUB_TOKEN }}
59+
run: |
60+
ai-reviewer review-pr \
61+
${{ github.repository }} \
62+
${{ steps.pr.outputs.number }} \
63+
--agents ${{ steps.pr.outputs.agents }} \
64+
--reviewer-name "MeroReviewer" \
65+
--output github

.github/workflows/doc-update.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Doc Auto-Update
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
workflow_dispatch:
7+
inputs:
8+
pr_number:
9+
description: "PR number to generate docs for (leave blank to auto-detect)"
10+
type: string
11+
required: false
12+
dry_run:
13+
description: "Dry run: print changes without opening a PR"
14+
type: boolean
15+
default: false
16+
17+
jobs:
18+
doc-update:
19+
uses: calimero-network/ai-code-reviewer/.github/workflows/doc-update.yaml@main
20+
with:
21+
dry_run: ${{ github.event.inputs.dry_run == 'true' }}
22+
pr_number: ${{ github.event.inputs.pr_number }}
23+
secrets:
24+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
25+
GH_PAT: ${{ secrets.GH_PAT }}

0 commit comments

Comments
 (0)