Skip to content

Running AI code review on sonarqubecloud[bot]'s branch #2333

Running AI code review on sonarqubecloud[bot]'s branch

Running AI code review on sonarqubecloud[bot]'s branch #2333

Workflow file for this run

name: AI Code Review
run-name: Running AI code review on ${{ github.actor }}'s branch
on:
pull_request:
types: [opened, reopened, ready_for_review, synchronize]
issue_comment:
types: [created]
permissions:
contents: write
issues: write
pull-requests: write
concurrency:
group: pr-ai-${{ github.event.number || github.event.issue.number }}-${{ github.event.comment.body || 'pr' }}
cancel-in-progress: true
jobs:
getPRHead:
name: Get PR head SHA
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' || (github.event_name == 'issue_comment' && (github.event.comment.body == '/review' || github.event.comment.body == '/describe' || github.event.comment.body == '/improve'))
outputs:
sha: ${{ steps.pr-head.outputs.result }}
prId: ${{ github.event.number || github.event.issue.number }}
steps:
- name: Get PR head SHA
id: pr-head
uses: actions/github-script@v8
with:
result-encoding: string
script: |
const prId = ${{ github.event.number || github.event.issue.number }};
const { data: pr } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: parseInt(prId, 10)
});
return pr.head.sha;
aiCodeReview:
name: Run AI Code Review on the PR
runs-on: ubuntu-latest
needs: getPRHead
steps:
- name: Checkout Repository
uses: actions/checkout@v6
with:
ref: ${{ needs.getPRHead.outputs.sha }}
- name: Setup CI
uses: ./.github/composite/setup-ci
with:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Load secrets
uses: ./.github/composite/load-secrets
with:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
UNLOAD_ENVIRONMENTS: ci
- name: Run composite workflow
uses: ./.github/composite/notion-checks
id: notion_check
with:
PR_ID: ${{ github.event.number || github.event.issue.number }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
GET_GHA_OUTPUT: "true"
VALIDATE_TICKET: "false"
- name: Load STYLEGUIDE.md
id: styleguide
run: |
echo "context<<EOF" >> $GITHUB_OUTPUT
cat ./STYLEGUIDE.md >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Qodo PR-Agent
uses: qodo-ai/pr-agent@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
config.model: "gemini/gemini-2.5-flash"
config.fallback_models: '["gemini/gemini-2.5-flash"]'
GOOGLE_AI_STUDIO.GEMINI_API_KEY: ${{ env.GEMINI_API_KEY }}
config.verbosity_level: "2"
pr_reviewer.extra_instructions: |
Review this PR in the context of the following Notion task:
${{ steps.notion_check.outputs.context }}
Additional review guidelines:
- Verify that the implementation matches the acceptance criteria from the Notion task
- Check for proper error handling and edge cases
- Ensure code follows existing patterns and architecture in the codebase
- Look for potential security vulnerabilities or data validation issues
- Verify that database migrations (if any) are reversible and safe
- Check for proper logging and monitoring considerations
- Ensure API endpoints follow RESTful conventions and existing API patterns
- Verify that environment variables and secrets are handled securely
- Check for potential performance bottlenecks or N+1 query issues
- Ensure proper test coverage for critical paths
The repository follows strict style guidelines, so please use the listed items below to
ensure code quality & correctness.
${{ steps.styleguide.outputs.context }}
pr_reviewer.persistent_comment: "false"
pr_reviewer.enable_review_labels_security: "false"
pr_reviewer.enable_review_labels_effort: "false"
pr_reviewer.final_update_message: "false"
pr_description.publish_description_as_comment: "true"
pr_description.extra_instructions: |
Below is some additional context for the PR from the connected Notion task:
${{ steps.notion_check.outputs.context }}
The repository follows strict style guidelines, so please use the listed items below to
ensure code quality & correctness.
${{ steps.styleguide.outputs.context }}
pr_description.publish_description_as_comment_persistent: "false"
pr_description.publish_labels: "false"
pr_description.add_original_user_description: "false"
pr_code_suggestions.commitable_code_suggestions: "true"
pr_code_suggestions.dual_publishing_score_threshold: "-1"
pr_code_suggestions.focus_only_on_problems: "true"
pr_code_suggestions.enable_help_text: "false"
pr_code_suggestions.enable_chat_text: "false"
pr_code_suggestions.persistent_comment: "false"
pr_code_suggestions.max_history_len: "10"
pr_code_suggestions.publish_output_no_suggestions: "true"
pr_code_suggestions.extra_instructions: |
Scrutinize this PR in the context of the following Notion task:
${{ steps.notion_check.outputs.context }}
Additional review guidelines:
- Verify that the implementation matches the acceptance criteria from the Notion task
- Check for proper error handling and edge cases
- Ensure code follows existing patterns and architecture in the codebase
- Look for potential security vulnerabilities or data validation issues
- Verify that database migrations (if any) are reversible and safe
- Check for proper logging and monitoring considerations
- Ensure API endpoints follow RESTful conventions and existing API patterns
- Verify that environment variables and secrets are handled securely
- Check for potential performance bottlenecks or N+1 query issues
- Ensure proper test coverage for critical paths
The repository follows strict style guidelines, so please use the listed items below to
ensure code quality & correctness.
${{ steps.styleguide.outputs.context }}
pr_code_suggestions.apply_suggestions_checkbox: "true"
pr_code_suggestions.suggestions_score_threshold: "0"
pr_code_suggestions.new_score_mechanism: "true"
pr_code_suggestions.new_score_mechanism_th_high: "9"
pr_code_suggestions.new_score_mechanism_th_medium: "7"
pr_code_suggestions.auto_extended_mode: "true"
pr_code_suggestions.num_code_suggestions_per_chunk: "3"
pr_code_suggestions.num_best_practice_suggestions: "1"
pr_code_suggestions.max_number_of_calls: "3"
pr_code_suggestions.parallel_calls: "true"
github_action_config.auto_review: "true"
github_action_config.auto_describe: "true"
github_action_config.auto_improve: "true"
github_action_config.pr_actions: '["opened","reopened","ready_for_review","synchronize"]'
github_action_config.handle_push_trigger: "true"
github_action_config.push_trigger_ignore_bot_commits: "true"
github_action_config.push_trigger_ignore_merge_commits: "true"
github_action_config.push_trigger_wait_for_initial_review: "true"
github_action_config.push_trigger_pending_tasks_backlog: "true"
github_action_config.push_trigger_pending_tasks_ttl: "300"