CodeWhisper for Azure PipelinesThe CodeWhisper for Azure Pipelines leverages the GPT model from OpenAI or Anthropic to review Pull Requests and provide feedback as comments in the Pull Request. This document provides a comprehensive guide on how to set up and use this task in your Azure Pipelines. SetupBefore using this task, ensure that the build service has permissions to contribute to Pull Requests in your repository, and allow the task to access the system token. Give permission to the build service agentAllow Task to access the system tokenDepending on the type of pipeline you are using, follow one of the two steps below: Yaml pipelinesAdd a checkout section with persistCredentials set to true.
Classic editorsEnable the option "Allow scripts to access the OAuth token" in the "Agent job" properties. OpenAI ModelsThe supported models are "gpt-4", "gpt-3.5-turbo", and "gpt-3.5-turbo-16k". If no model is selected, the "gpt-4o" is used. Anthropic ModelsThe supported models are "claude-3-opus-20240229", "claude-3-5-sonnet-20240620", and "claude-3-haiku-20240307". If no model is selected, the "claude-3-5-sonnet-20240620" is used. How to use itInstall the extensionTo use the CodeWhisper Task, first install the extension in your Azure DevOps organization. Click on the "Get it free" button and follow the prompts to install it. You may need to authorize the extension to access your Azure DevOps account. Add the task to the build pipelineAfter installing the extension, add the task to your build pipeline. Go to your build pipeline, click on the "+" icon to add a new task, and search for "CodeWhisper". Select it and add it to your pipeline. Configure the taskOnce you have added the task to your pipeline, configure it. In the task configuration, provide your API key for OpenAI API. To create an API key, go to https://platform.openai.com/account/api-keys. Review Pull RequestsWhen the build is triggered from a Pull Request, the task will review it. If there is feedback on the changed code, the task will add comments to the Pull Request. If the build is triggered manually, the task will be skipped. Compatible with Linux Build AgentsThe tasks can execute on all supported build agent operating systems including Linux and MacOS. Task OptionsThe task has several configuration options:
For more detailed information, refer to the task.json file. Example UsageHere is an example of how to configure the task in a YAML pipeline:
For more details on the implementation, refer to the index.ts and review.ts files. LicenseThis project is licensed under the MIT License. See the LICENSE file for details. |