Automate pull request (PR) reviews in Azure DevOps using the PR Inspection Assistant (PRIA) and OpenAI. This bot analyzes code changes, offers suggestions, detects potential bugs, and ensures adherence to coding standards. Streamline code reviews with customizable criteria and natural language feedback, improving code quality and reducing review time.
- Automated PR Reviews: Leverage OpenAI to analyze code changes in pull requests.
- Code Quality Suggestions: Detect potential issues and ensure best practices are followed.
- Customizable Review Criteria: Tailor the bot to specific code quality metrics.
- Azure DevOps Integration: Seamlessly integrates with existing DevOps pipelines.
- Natural Language Feedback: Provides human-readable, actionable feedback.
- Automate Routine PR Tasks: Speed up the code review process by automating common review tasks.
- Improve Code Quality: Receive consistent, detailed feedback to enhance code quality.
- Early Bug Detection: Help developers understand best practices and identify bugs early in the development cycle.
- An OpenAI API Key
- Build Administrators must be given "Contribute to pull requests" access. Check this Stack Overflow answer for guidance on setting up permissions.
-
Install the PRIA DevOps Extension
Install the PRIA DevOps extension from the Azure DevOps Marketplace.
-
Create a PRIA Code Review Pipeline
Create an Azure DevOps Pipeline using the following YAML snippet to set up the PRIA code review task:
trigger: branches: exclude: - '*' pr: branches: include: - '*' jobs: - job: CodeReview pool: vmImage: 'ubuntu-latest' steps: - checkout: self persistCredentials: true - task: PRIA@1 inputs: api_key: $(OpenAI_ApiKey)
-
Configure your Main Branch for Build Validation
Cofigure Azure DevOps Build Validation to use PRIA Code Review Pipeline created above as a build validation pipeline.
- Install Prequisites
- Run
npm install -g typescript
to install TypeScript - Run
tsc.cmd
from.\pr-inspection-assistant\src\
to build the solution - Run
tfx extension create --manifest-globs vss-extension.json
from.\pr-inspection-assistant\
to package the solution