|
1 | 1 | --- |
2 | | -title:Integrating CodeRabbit with GitHub.com |
| 2 | +title:Integrate with GitHub.com |
3 | 3 | description:Learn how to integrate CodeRabbit and add to your GitHub workflow. |
4 | 4 | sidebar_label:GitHub.com |
5 | | -sidebar_position:1 |
6 | 5 | --- |
7 | 6 |
|
8 | 7 | This is a step-by-step guide to integrate CodeRabbit with your GitHub repositories. |
9 | 8 |
|
10 | | ->**CodeRabbit** is an AI code reviewer designed to ease the challenges of code review, supporting repository maintainers and teams. It reviews your PRs and provides concise summaries, identifies potential issues, and offers insights that might be missed during manual reviews. |
| 9 | +For an overview of how CodeRabbit integrates with Git platforms, see |
| 10 | +[Add CodeRabbit to your repository](/platforms). |
11 | 11 |
|
12 | | -##How CodeRabbit Works? |
| 12 | +For a hands-on tutorial with CodeRabbit performing code reviews on a live |
| 13 | +GitHub repository that you create, see[Quickstart](/getting-started/quickstart). |
13 | 14 |
|
14 | | ->CodeRabbit integrates with GitHub, automating the code review process from the moment a pull request is created. |
| 15 | +##Before you begin |
15 | 16 |
|
16 | | -It preprocesses the PR content, builds context, leverages Large Language Models for analysis,andthen post-processes the AI response before posting the review back to GitHub. This streamlined workflow ensures thorough AI-powered code reviews without manual intervention. |
| 17 | +You need to have a GitHub account,andownership-level permissions of at least one repository associated with that account. |
17 | 18 |
|
18 | | - |
| 19 | +If you want to authorizeCodeRabbitto write code reviews for a repository contained in a GitHub organization, then you need ownership-level permission with that organization, as well. |
19 | 20 |
|
20 | | -##Let's IntegrateCodeRabbit with GitHub |
| 21 | +##AuthorizeCodeRabbit withyourGitHub account |
21 | 22 |
|
22 | | -###1. Accessing CodeRabbit |
| 23 | +Before you can you use CodeRabbit with GitHub, you need to |
| 24 | +authorize CodeRabbit with your GitHub account. To do this, follow these steps: |
23 | 25 |
|
24 | | -Visit the[CodeRabbit login](https://app.coderabbit.ai/login?free-trial) page. You'll see all the authentication options, select "**Login with GitHub**" to proceed. |
| 26 | +1.Visit[the CodeRabbit login page](https://app.coderabbit.ai/login). |
25 | 27 |
|
26 | | - |
| 28 | +1. Click**Login with GitHub**. Your browser navigates to GitHub.com. |
27 | 29 |
|
28 | | -###2. Authorization |
| 30 | +1. If GitHub prompts to sign in to your GitHub account before continuing, then enter your GitHub login credentials as you normally would. Otherwise, continue to the next step. |
29 | 31 |
|
30 | | -When you choose**Login with GitHub** in step1, you'll be prompted to authorize CodeRabbit. |
| 32 | +1. GitHub displays a summary of the information that CodeRabbit needs in order to integrate with your |
| 33 | + GitHub account. This includes read-only access to the following: |
31 | 34 |
|
32 | | ->This step grants the necessary permissions for CodeRabbit to interact with your repositories and pull requests. |
| 35 | +* Organizations and teams that are associated with your GitHub account. |
33 | 36 |
|
34 | | - |
| 37 | +* Email addresses that are associated with your GitHub account. |
35 | 38 |
|
36 | | -###3. Selecting Your Organization |
| 39 | +To allow CodeRabbit access to this information, click **Authorize coderabbitai**. |
37 | 40 |
|
38 | | -Upon Authorization, Ifyou're part of multiple organizations, you'll have the opportunitytochoose which one you want to associate withCodeRabbit. This ensures that you're setting up the tool for the correct team or project. |
| 41 | +Afteryou complete these steps, your browser navigatestotheCodeRabbit web interface. |
39 | 42 |
|
40 | | - |
| 43 | +Now that you've integrated CodeRabbit with your GitHub account, you need to giveCodeRabbit additional permissions to work with your code repositories. To do this, see the next section. |
41 | 44 |
|
42 | | -###4. Exploring the CodeRabbit Dashboard |
| 45 | +##Allow CodeRabbit to access your repositories |
43 | 46 |
|
44 | | -Upon successful authorization, you'll be logged into the CodeRabbit user interface. |
| 47 | +Even after you've integrated CodeRabbit with your GitHub account, you need to |
| 48 | +separately grant CodeRabbit the permissions that it needs to post code reviews and |
| 49 | +create pull requests in your repositories. |
45 | 50 |
|
46 | | -Here, you can add repositories and configure CodeRabbit config settings for each repository. |
| 51 | +You need to authorize CodeRabbit separately for each GitHub organization whose repositories you want it to work with. You can give CodeRabbit permission to |
| 52 | +work with all of the repositories associated with a GitHub organization, or limit its access to a select list. |
47 | 53 |
|
48 | | - |
| 54 | +###Overview of required permissions |
49 | 55 |
|
50 | | -:::tip |
51 | | -If you opt to authorize all repositories during setup, CodeRabbit will automatically include any new repositories you create on GitHub in the future. This saves you the hassle of manual additions down the line. |
52 | | -::: |
| 56 | +CodeRabbit requires the following permissions to work with your repositories: |
53 | 57 |
|
54 | | -###5. CodeRabbit Configuration |
| 58 | +- Read-only access to actions, checks, discussions, members, and metadata. |
55 | 59 |
|
56 | | -You can configure CodeRabbit through a YAML file or using the[App's UI](https://app.coderabbit.ai/login?free-trial). |
| 60 | +- Read-and-write access to code, commit statuses, issues, and pull requests. |
57 | 61 |
|
58 | | -You can tailorCodeRabbit's functionality using the`.coderabbit.yaml` file, which you place directly inyourGitHubrepository. This file mirrors the options available in the CodeRabbit user interface, with each setting in the YAML correspondingtoa specific toggle in the UI. ConfigureCodeRabbiteither through the coderabbit.yaml file or the interface, depending on your preference. |
| 62 | +CodeRabbit requests read and write access toyour repository in order for its code review, issue management, and pull request generation featurestowork.CodeRabbitnever stores your code. For more information, see[the CodeRabbit Trust Center](https://trust.coderabbit.ai). |
59 | 63 |
|
60 | | -:::note |
| 64 | +###Authorize CodeRabbit with your repositories |
61 | 65 |
|
62 | | -If a`.coderabbit.yaml` file exists in your GitHub repository, it takes precedence over any UI settings. Choose either the YAML fileorUI configuration - you don't need to use both.**Refer CodeRabbit YAML schema[here](https://storage.googleapis.com/coderabbit_public_assets/schema.v2.json)** |
| 66 | +To give CodeRabbit access to oneormore of your repositories, follow these steps: |
63 | 67 |
|
64 | | -::: |
| 68 | +1. Visit[the CodeRabbit web interface](https://app.coderabbit.ai/settings/repositories). |
65 | 69 |
|
66 | | -Once your`.coderabbit.yaml` file is prepared according to your needs, simply place it in your GitHub repository, and you're all set — CodeRabbit is now integrated. |
| 70 | +1. Make sure that the correct GitHub organization for the repository is displayed |
| 71 | + at the top of the web interface. To change the organization, click**Change |
| 72 | + Organization** and select a different organization from the list. |
67 | 73 |
|
68 | | ->When a pull request is created targetingthemaster branch, CodeRabbit automatically initiates its review process. It analyzes the changesandgenerates asummary and walkthrough of the modifications. The specific feedback and analysis provided by CodeRabbit are determined bytheoptions you've configured in your YAML file. |
| 74 | + Iftherepositories that you want to add are associated directly with your GitHub account,andnot aseparate organization, then select your account name astheorganization. |
69 | 75 |
|
70 | | -Let's see a few examples of CodeRabbit's review comments from a specific pull request in one of the projects. |
| 76 | + If the organization containing the repository doesn't appear in the list, then you might |
| 77 | + need to refresh the list of organizations that CodeRabbit has associated with your |
| 78 | + GitHub account. For more information, see[Add organizations](/getting-started/adding-organizations). |
71 | 79 |
|
72 | | -This particular PR involved in changingthelanguage model from LLaMA 2 to LLaMA 3, for testing purposes. These examples will showcase how CodeRabbit analyzed and commented on this significant model switch. |
| 80 | +1. Clickthe**Add Repositories** button. Your browser navigates to GitHub.com. |
73 | 81 |
|
74 | | -##Sample PR Review Workflow usingCodeRabbit |
| 82 | + If the selected organization has no repositories registered withCodeRabbit, then your browser displays a CodeRabbit permissions dialog for setting up a new integration. Proceed to the next step. |
75 | 83 |
|
76 | | -CodeRabbit automatically generates a PR summary highlighting key changes. |
| 84 | + Otherwise, your browser displays a GitHub settings page for your organization's existing CodeRabbit integration. Scroll down to the section titled**Repository access**, and then proceed to the next step. |
77 | 85 |
|
78 | | - |
| 86 | +1. Select which repositories you'd like to allowCodeRabbitto write code reviews for. |
79 | 87 |
|
80 | | -This image shows CodeRabbit's review status for another pull request. It highlights that**12 actionable comments** were generated, and the reviewalsoincludes additional comments on specific files, demonstrating CodeRabbit's comprehensive analysis ofthecode changes. |
| 88 | + To give CodeRabbit access to all repositories in the organization, select**All repositories**. Thisalsoautomatically grants CodeRabbit access to all repositories added to the organization inthefuture. |
81 | 89 |
|
82 | | - |
| 90 | + To giveCodeRabbit access to specific, limited list of repositories, select**Only select repositories**, and then choose repositories from the list. |
83 | 91 |
|
84 | | -You can also use[CodeRabbit commands](https://docs.coderabbit.ai/guides/commands/) to chat with the AI code Reviewer. |
| 92 | +:::note |
| 93 | + You can change this setting later. |
| 94 | + ::: |
85 | 95 |
|
86 | | - |
| 96 | +1. Click the button at the bottom of the form, which has one of the following labels, depending upon context: |
87 | 97 |
|
88 | | -CodeRabbit could generate a**code sequence diagram** when you request a full review. |
| 98 | +-**Install & Authorize**, if this organization has no repositories integrated with CodeRabbit, and you are an owner of this organization. |
| 99 | +-**Save**, if this organization already has repositories integrated with CodeRabbit |
89 | 100 |
|
90 | | -The sequence diagram illustrates the precise flow of interactions between theobjects inthesystem. |
| 101 | +1. If you are integrating an organization with CodeRabbit for thefirst time, then your browser navigates back totheCodeRabbit web interface. |
91 | 102 |
|
92 | | - |
| 103 | + Otherwise, your browser remains on your GitHub settings page, and you can manually navigate[back to theCodeRabbitweb interface](https://app.coderabbit.ai/settings/repositories). |
93 | 104 |
|
94 | | -Also, check out the response when asked for what improvements can be done on the code level. |
| 105 | +##What's next |
95 | 106 |
|
96 | | - |
| 107 | +-[Set your repository preferences](/guides/repository-settings) |
97 | 108 |
|
98 | | -In addition to providing reviews and summaries,**CodeRabbit** can also detect configuration issues. |
99 | | - |
100 | | ->For example, I accidentally set up both CodeRabbit Pro (The process we've been discussing) and the open-source version (Refer to[different config process](https://github.com/coderabbitai/ai-pr-reviewer?tab=readme-ov-file#install-instructions)) in my repository at the same time. |
101 | | -
|
102 | | -CodeRabbit automatically detects and alerts you about configuration conflicts. |
103 | | - |
104 | | - |
105 | | - |
106 | | -CodeRabbit generates detailed statistics and test plans for each pull request. |
107 | | - |
108 | | - |
109 | | - |
110 | | - |
111 | | - |
112 | | ->CodeRabbit also allows you to configure**custom review instructions** based on your organization's needs, in case you want it to follow specific guidelines beyond the standard review, to learn more on[adding custom review instructions](/guides/review-instructions) |
113 | | -
|
114 | | -Whether you manage a popular repository or are working on a smaller project, whether it's hosted on**GitLab, GitHub, or self-hosted GitHub or GitLab**, CodeRabbit can help streamline your development process. This AI Code Review assistant is designed to save you time by automating code reviews and offering insightful feedback. |
115 | | - |
116 | | ->Explore, Experiment, Discover how[CodeRabbit](https://docs.coderabbit.ai/) can streamline your code review process using AI. |
| 109 | +-[Review pull requests](/guides/code-review-overview) |