Skip to content

Commit c03766f

Browse files
committed
ci: add pr review bot
1 parent 7591a05 commit c03766f

File tree

7 files changed

+112
-1
lines changed

7 files changed

+112
-1
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ No matter your changes, these checks always apply.
3838
- If you create a new header, it aligns with the **Impact on version** section and matches what is generated in the build pipeline.
3939
- [ ] Documentation files were updated according with the changes.
4040
- Update `README.md` and `src/cli/CLI.md` if you made changes to **templating**.
41-
- Update `AzurePipelines.md` and `src/app/README.md` if you made changes to **pipelines**.
41+
- Update `AzurePipelines.md` and `src/app/README.md` if you made changes to **Azure Pipelines**.
42+
- Update `GitHubActions.md` if you made changes to **GitHub Actions workflows**.
4243
- Update `Diagnostics.md` if you made changes to **diagnostic tools**.
4344
- Update `Architecture.md` and its diagrams if you made **architecture decisions** or if you introduced new **recipes**.
4445
- ...and so forth: Make sure you update the documentation files associated to the recipes you changed. Review the topics by looking at the content of the `doc/` folder.

.github/workflows/pr-review.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: PR Review Bot
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
permissions:
8+
contents: read
9+
pull-requests: write
10+
11+
jobs:
12+
review:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: "3.11"
24+
25+
- name: Run Pull Request Bot
26+
uses: nventive/pull-request-bot@v2
27+
with:
28+
api-key: ${{ secrets.ANTHROPIC_API_KEY }}
29+
config-path: "./pull-request-bot.json"

CONTRIBUTING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ use GitHub pull requests for this purpose. Consult [GitHub
8181
Help](https://help.github.com/articles/about-pull-requests/) for more
8282
information on using pull requests.
8383

84+
> 💡 Pull requests are automatically reviewed by an **AI-powered PR Review Bot**
85+
> in addition to human reviewers. The bot may post review comments and suggest
86+
> fixes on your pull request. See [GitHubActions.md](doc/GitHubActions.md) for
87+
> details on how this is configured.
88+
8489
## Community Guidelines
8590

8691
This project follows [Google's Open Source Community

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ Please read [CONTRIBUTING](CONTRIBUTING.md) for details on the process for contr
5353

5454
Be mindful of our [Code of Conduct](CODE_OF_CONDUCT.md).
5555

56+
## CI/CD & Automation
57+
58+
- [Azure Pipelines](doc/AzurePipelines.md) — Build, test, and release pipelines.
59+
- [GitHub Actions](doc/GitHubActions.md) — Pull request automation (conventional commits validation, AI-powered code review).
60+
5661
### Application Template
5762

5863
To debug the app from within the template, run the following commands:

doc/GitHubActions.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# GitHub Actions
2+
3+
This project uses [GitHub Actions](https://docs.github.com/en/actions) workflows for pull request automation. These are separate from the [Azure Pipelines](AzurePipelines.md) which handle the build, test, and release CI/CD process.
4+
5+
All workflow files are located under [`.github/workflows/`](../.github/workflows/).
6+
7+
## Workflows
8+
9+
### Conventional Commits ([conventional-commits.yml](../.github/workflows/conventional-commits.yml))
10+
11+
This workflow validates that all commit messages in a pull request follow the [Conventional Commits](https://www.conventionalcommits.org/) specification. It runs [Commitsar](https://commitsar.aevea.ee/) via Docker on every pull request.
12+
13+
This ensures consistent commit history and enables automated versioning based on commit types.
14+
15+
### PR Review Bot ([pr-review.yml](../.github/workflows/pr-review.yml))
16+
17+
This workflow provides **AI-powered code review** on pull requests using the [`nventive/pull-request-bot`](https://github.com/nventive/pull-request-bot) action.
18+
19+
#### Triggers
20+
21+
The bot runs automatically when a pull request is:
22+
- **Opened**
23+
- **Synchronized** (new commits pushed)
24+
- **Reopened**
25+
26+
#### Permissions
27+
28+
The workflow requires the following permissions:
29+
- `contents: read` — to read the repository code.
30+
- `pull-requests: write` — to post review comments and update the PR description.
31+
32+
#### Configuration
33+
34+
The bot behavior is configured in [`src/pull-request-bot.json`](../src/pull-request-bot.json):
35+
36+
| Setting | Value | Description |
37+
|-|-|-|
38+
| Model | Claude Opus | The AI model used for code review. |
39+
| Excluded patterns | `tests/**`, `**/*.test.js` | Files excluded from review. |
40+
| Max file size | 320 KB | Files larger than this are skipped. |
41+
| Auto-fix enabled | Yes | The bot can suggest automatic fixes. |
42+
| Confidence threshold | 85% | Minimum confidence required for auto-fix suggestions. |
43+
| Max fixes per file | 5 | Maximum number of auto-fix suggestions per file. |
44+
| PR description mode | Append | The bot appends a summary to the PR description. |
45+
46+
#### Required Secret
47+
48+
| Secret | Description |
49+
|-|-|
50+
| `ANTHROPIC_API_KEY` | API key for the Anthropic Claude model used by the PR Review Bot. This must be configured in the repository's [GitHub Actions secrets](https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions). |

pull-request-bot.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"claude_code": {
3+
"model": "opus"
4+
},
5+
"file_filter": {
6+
"exclude_patterns": ["tests/**", "**/*.test.js"],
7+
"max_file_size": 327680
8+
},
9+
"auto_fix": {
10+
"enabled": true,
11+
"confidence_threshold": 0.85,
12+
"max_fixes_per_file": 5
13+
},
14+
"pr_description": {
15+
"enabled": true,
16+
"mode": "append"
17+
}
18+
}

src/cli/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
55

66
Prefix your items with `(Template)` if the change is about the template and not the resulting application.
77

8+
## 0.26.3
9+
- Add PR bot to check PRs in GitHub.
10+
811
## 0.26.2
912
- Fix issue with dispose in VM.
1013
- Fix errors in documentation.

0 commit comments

Comments
 (0)