Skip to content
| Marketplace
Sign in
Azure DevOps>Azure Pipelines>ADOPRCodeReviewAI
ADOPRCodeReviewAI

ADOPRCodeReviewAI

junior151280

|
1 install
| (0) | Preview
This task uses Azure OpenAI model to review Pull Requests
Get it free

Use OpenAI GPT Model to Review Pull Requests for Azure DevOps

Azure DevOps task that adds comments to Pull Requests with the help of GPT.

Installation

The installation can be done using the Visual Studio MarketPlace.

Azure OpenAI Service

Azure OpenAI supports two endpoint formats:

Format 1 (Legacy):

https://{RESOURCE}.openai.azure.com/openai/deployments/{MODEL_NAME}/chat/completions?api-version={API_VERSION}

Format 2 (Current):

https://{ADMIN-RESOURCE}.{REGION}.cognitiveservices.azure.com/openai/deployments/{MODEL_NAME}/chat/completions?api-version={API_VERSION}

Example:

https://admin-ma4fdje4-eastus2.cognitiveservices.azure.com/openai/deployments/gpt-4.1-jailtons/chat/completions?api-version=2025-01-01-preview

REST API Documentation.

Grant Permissions to the Build Service Agent

Before using this task, make sure the build service has permissions to contribute to your REPOSITORY.

Step-by-step:

  1. Go to Project Settings in Azure DevOps
  2. Navigate to Repositories → select your repository
  3. Click on the Security tab
  4. Find {Project Name} Build Service ({Organization Name})
  5. Set the following permissions to Allow:
    • ✅ Contribute to pull requests
    • ✅ Contribute

Alternative: Enable in Pipeline Settings

  1. Go to your pipeline
  2. Click Edit
  3. Click the ⋮ (More actions) menu → Settings
  4. Under YAML → Advanced, enable:
    • ☑️ Allow scripts to access the OAuth token

contribute_to_pr

Common Issues:

  • If you see 401 Unauthorized errors, the Build Service lacks the required permissions
  • Make sure both repository permissions AND pipeline OAuth token access are enabled
  • For more details, see: https://stackoverflow.com/a/57985733

Allow the Task to Access the System Token

Add a checkout section with persistCredentials set to true.

YAML Pipelines

jobs:
- job:
  displayName: "JPCompcombr code review"
  pool:
    vmImage: ubuntu-latest 
 
  steps:
  - checkout: self
    persistCredentials: true

  - task: JPCompcombr@20
    displayName: GPTPullRequestReview
    inputs:
      api_key: 'YOUR_TOKEN'
      model: 'gpt-4'
      aoi_endpoint: 'https://{XXXXXXXX}.azure.com/openai/deployments/{MODEL_NAME}/chat/completions?api-version={API_VERSION}'
      aoi_tokenMax: 1000
      aoi_temperature: 0
      file_extensions: 'js,ts,css,html'
      file_excludes: 'file1.js,file2.py,secret.txt'
      additional_prompts: 'Comma-separated prompts, example: check variable naming, ensure consistent indentation, review error handling approach'

License

MIT

Plus

Devops Publish

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