-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: PraisonAI PR Reviewer Integration #1332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| framework: praisonai | ||
| topic: Pull Request Review | ||
| roles: | ||
| lead_reviewer: | ||
| role: Lead Code Reviewer | ||
| goal: Provide a comprehensive and constructive review of the pull request | ||
| backstory: You are an expert software engineer with deep knowledge of best practices, security, and performance. You meticulously review code for bugs and maintainability. | ||
| tasks: | ||
| code_review: | ||
| description: Review the code changes in the pull request. Look for logic errors, formatting issues, security flaws, and performance bottlenecks. Output the review as a detailed markdown comment. | ||
| expected_output: A detailed PR review in markdown format. | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,40 @@ | ||||||
| name: PraisonAI PR Reviewer | ||||||
|
|
||||||
| on: | ||||||
| pull_request: | ||||||
| types: [opened, synchronize, reopened, ready_for_review] | ||||||
| issue_comment: | ||||||
| types: [created] | ||||||
|
Comment on lines
+6
to
+7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The if: |
(github.event_name == 'pull_request' && github.event.pull_request.draft == false) ||
(github.event_name == 'issue_comment' &&
contains(github.event.comment.body, '@praisonai') &&
(github.event.comment.author_association == 'OWNER' ||
github.event.comment.author_association == 'MEMBER' ||
github.event.comment.author_association == 'COLLABORATOR')) |
||||||
|
|
||||||
| jobs: | ||||||
| review: | ||||||
| runs-on: ubuntu-latest | ||||||
| if: github.event.pull_request.draft == false && (github.event_name == 'pull_request' || contains(github.event.comment.body, '@praisonai')) | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2. Manual trigger never runs The job if: condition references github.event.pull_request.draft, which is not present for issue_comment events, so @praisonai comments will not trigger the reviewer job. Agent Prompt
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The job-level The fix is to guard each branch independently:
Suggested change
|
||||||
|
|
||||||
|
Comment on lines
+11
to
+13
|
||||||
| steps: | ||||||
| - name: Checkout Repository | ||||||
| uses: actions/checkout@v4 | ||||||
| with: | ||||||
| fetch-depth: 0 | ||||||
|
|
||||||
| - name: Generate GitHub App Token | ||||||
| id: generate_token | ||||||
| uses: tibdex/github-app-token@v2 | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
You can find the current SHA for the |
||||||
| with: | ||||||
| app_id: ${{ secrets.APP_ID }} | ||||||
| private_key: ${{ secrets.PRIVATE_KEY }} | ||||||
|
|
||||||
| - name: Set up Python | ||||||
| uses: actions/setup-python@v5 | ||||||
| with: | ||||||
| python-version: '3.11' | ||||||
|
|
||||||
| - name: Install PraisonAI | ||||||
| run: pip install praisonaiagents[all] | ||||||
|
Comment on lines
+32
to
+33
|
||||||
|
|
||||||
| - name: Run PraisonAI PR Review | ||||||
| env: | ||||||
| GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} | ||||||
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||||||
| run: | | ||||||
| praisonai agents --file .github/praisonai-reviewer.yaml | ||||||
|
Comment on lines
+35
to
+40
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # PraisonAI PR Reviewer Setup Guide | ||
|
|
||
| This guide explains how to set up PraisonAI as an automated pull request reviewer using GitHub Actions and GitHub Apps. | ||
|
|
||
| ## Prerequisites | ||
| 1. A GitHub App created within your organization or account. | ||
| 2. The App must have the following permissions: | ||
| - Pull Requests: Read & Write | ||
| - Issues: Read & Write | ||
| - Contents: Read | ||
| 3. Generate a Private Key for the GitHub App. | ||
|
|
||
| ## Setup Steps | ||
|
|
||
| 1. Configure GitHub Secrets for your repository: | ||
| - `APP_ID`: The App ID of your GitHub App. | ||
| - `PRIVATE_KEY`: The generated Private Key (PEM format). | ||
| - `OPENAI_API_KEY` (or other LLM key) for PraisonAI to use. | ||
|
|
||
| 2. Ensure `.github/workflows/praisonai-pr-review.yml` is present in your default branch. | ||
|
|
||
| 3. Customize `.github/praisonai-reviewer.yaml` to configure the reviewing agents with specific roles. | ||
|
|
||
| ## Triggering the Review | ||
| The review will run automatically upon PR creation and synchronization. You can also trigger it manually by commenting `@praisonai` on any pull request or issue. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| name: PraisonAI PR Reviewer | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened, ready_for_review] | ||
| issue_comment: | ||
| types: [created] | ||
|
|
||
| jobs: | ||
| review: | ||
| runs-on: ubuntu-latest | ||
| if: github.event.pull_request.draft == false && (github.event_name == 'pull_request' || contains(github.event.comment.body, '@praisonai')) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The current |
||
|
|
||
|
Comment on lines
+10
to
+13
|
||
| steps: | ||
| - name: Checkout Repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Generate GitHub App Token | ||
| id: generate_token | ||
| uses: tibdex/github-app-token@v2 | ||
| with: | ||
| app_id: ${{ secrets.APP_ID }} | ||
| private_key: ${{ secrets.PRIVATE_KEY }} | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.11' | ||
|
|
||
| - name: Install PraisonAI | ||
| run: pip install praisonaiagents[all] | ||
|
Comment on lines
+32
to
+33
|
||
|
|
||
| - name: Run PraisonAI PR Review | ||
| env: | ||
| GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} | ||
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
| run: | | ||
| # Use PraisonAI to review the PR | ||
| praisonai agents --file .github/praisonai-reviewer.yaml | ||
|
Comment on lines
+35
to
+41
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
code_reviewtask instructs the agent to "review the code changes in the pull request," but no GitHub API tools or any file-access tools are configured for the agent. In the workflow, the repo is checked out, but the agent is given no mechanism to:git diffor read changed filesWithout a tool like
gh pr diffor a GitHub REST tool, the LLM will produce a generic, fabricated review that does not reflect the actual code changes. At minimum, the task description should provide the diff inline (e.g., via a shell step that capturesgit diffoutput and passes it to the agent), or the agent configuration should include GitHub tools.