Skip to content
| Marketplace
Sign in
Azure DevOps>Azure Pipelines>OpenAI Code Review
OpenAI Code Review

OpenAI Code Review

GN Group

|
42 installs
| (3) | Free
Automate code analysis after PR creation. Use OpenAI to provide code quality feedback.
Get it free

Azure DevOps Extension for Automated Code Reviews with Azure OpenAI

Overview

This project is an Azure DevOps Extension that automates code reviews using Azure OpenAI. Once a pull request (PR) is created in a repository, this extension triggers a code review process powered by Azure OpenAI, providing suggestions and improvements directly in the PR.

Key Features

  • Automated code analysis after PR creation.
  • Intelligent feedback generated by Azure OpenAI, tailored to the code changes.
  • Seamless integration with Azure DevOps workflow.
  • Customizable review templates for different coding standards and practices.
  • Easy installation and setup in your Azure DevOps environment.

Task Details

This extension includes a custom task called Pull Request Code Review with OpenAI, which automates the code review process for pull requests using Azure OpenAI.

Task Information

  • ID: 5ac5fe12-459c-47e7-a278-26bd07f7f4e3
  • Name: AIPRCodeReview
  • Friendly Name: Pull Request Code Review with OpenAI
  • Description: Automatically reviews code changes in pull requests using OpenAI.
  • Category: Utility
  • Author: GN Group
  • Visibility: Build
  • Minimum Agent Version: 1.95.0
  • Execution: Compatible with Node 10 and Node 16.

Task Inputs

Input Name Type Required Default Value Description
api_key string Yes The API key for accessing OpenAI or Azure OpenAI.
ai_model string No gpt-4 The OpenAI model to use for code review.
file_extensions string No Comma-separated list of file names or paths to exclude from the review.
base_api_url string Yes Base API URL to OpenAI service.
file_excludes string No Comma-separated list of file names or paths to exclude from the review.
disable_default_prompts string No Additional prompts will fully override the defaults (comma-separated).
additional_prompts string No Additional instructions to include in the code review prompt (comma-separated).
bugs boolean No true Check this box if you want OpenAI to specifically look for bugs in the code.
security boolean No true Check this box if you want OpenAI to flag potential security issues.
naming_conventions boolean No true Check this box if you want OpenAI to flag naming convention issues.
error_handling boolean No true Check this box if you want OpenAI to flag potential error handling issues.
performance boolean No true Check this box if you want OpenAI to flag potential performance issues.
best_practices boolean No true Check this box if you want OpenAI to provide best practice recommendations.
reset_comments boolean No false Check this box if you want to reset all comments in the pull request after each build.
max_tokens number No 500 The maximum number of tokens to use for the OpenAI.

Execution

This task runs on the Node.js environment and supports both Node 10 and Node 16. It triggers when a pull request is created or updated and provides feedback directly on the PR using Azure OpenAI's suggestions.

Messages

  • TaskCompleted: "The pull request has been successfully reviewed."
  • SkippingTask: "This task is skipped because it's not triggered by a Pull Request."
  • FailedOAuth: "'Allow Scripts to Access OAuth Token' must be enabled for this task."

Prerequisites

Before using the Pull Request Code Review with OpenAI task, make sure that your Azure DevOps build service has the necessary permissions to contribute to pull requests in your repository.

Step 1: Give Permission to the Build Service Agent

  1. Navigate to your repository settings in Azure DevOps.
  2. Select Security from the left menu.
  3. Under Permissions, find the build service user (usually in the format [ProjectName] Build Service ([OrganizationName])).
  4. Ensure that the Contribute to pull requests permission is set to Allow.

This permission is necessary for the task to add review comments directly to your pull requests.

Installation and Setup

To install this Azure DevOps extension:

  1. Navigate to your Azure DevOps project.
  2. Go to the Extensions Marketplace and search for "Azure DevOps Extension for Automated Code Reviews with Azure OpenAI".
  3. Click on the extension and follow the installation steps.

Configuration

  1. Add the Task to Your Pipeline:

    • Edit your pipeline YAML file or use the classic editor.
    • Add the Pull Request Code Review with OpenAI task to the pipeline.
  2. Provide the Required Inputs:

    • Make sure to enter your OpenAI API Key and configure the review options according to your needs.
  3. Set Up API Authentication:

    • Ensure that your API key has the appropriate permissions to access OpenAI services.

Usage

Once the extension is installed and configured, it will automatically trigger a code review every time a pull request is created or updated. The results of the review will be added as comments directly on the PR, helping your team to make improvements and fix issues faster.

- task: AIPRCodeReview@1 or 2 (to complex overview)
  inputs:
    base_api_url: "$(OpenAI_BaseUrl)"
    api_key: "$(OpenAI_ApiKey)"
    file_extensions: ".js,.tsx,.ts,.yml"
    file_excludes: "sitecore/**,**/*.json"

Contributions

We welcome contributions! Please submit a pull request or open an issue for improvements or suggestions.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft