Creating a pull request should not always happen when your changes are fully ready. Sometimes you want to create a pull request as soon as possible (while its state is still work-in-progress), so that you can engage the discussion early on with your teammates.
When that happens, you probably don’t want all Code Owners to be added as reviewers right away. Indeed, you would first need to tell them not to look at your pull request for now. And this creates a lot of noise for them.
With Draft Pull Requests, you can have the best of both worlds.
Mark your Pull Request as Draft
When creating a pull request, you can decide to mark your Pull Request as Draft by clicking on the “PR Draft” button in the Code Owners section.
By doing that, no Code Owners will be automatically assigned to your pull request until you mark your Pull Request as being ready. You can still manually add reviewers (the usual way) if you want to cherry pick them.
Mark your Pull Request as Ready
Once you are satisfied with the state of the pull request, you can mark it as Ready for review. When you do so, all Code Owners will be added automatically. This assumes that you have the auto-assignment enabled, which is the default. If it has been disabled, you can re-enable it via the addon setting.
To mark a pull request as being Ready for review, you can click on the contextual menu on the top left, then click on the “Ready for review” button.
Benefits of Draft Pull Requests
Draft Pull Requests offer several advantages that can enhance your collaboration workflow and streamline the review process. By marking your Pull Request as a draft, you can enjoy the following benefits.
Early Engagement and Discussion
Creating a Pull Request as a draft allows you to share your work-in-progress changes with your teammates at the earliest stage possible. It enables you to engage in early discussions, gather initial feedback, and involve relevant stakeholders in the decision-making process from the beginning. By fostering collaboration from the outset, you can ensure that everyone's input is considered and incorporated into the final solution.
Reduced Noise for Code Owners
When you create a Pull Request as a draft, Code Owners are not automatically assigned as reviewers. This prevents unnecessary notifications and noise for Code Owners who might otherwise be inundated with review requests for work that is not yet ready for their attention. By giving Code Owners the flexibility to focus on fully ready Pull Requests, you can help them prioritize their time and efforts more effectively.
Incremental Feedback and Iterative Development
Draft Pull Requests enable an iterative development process by allowing you to receive feedback in smaller increments. Instead of waiting until your changes are fully complete before seeking review, you can share your work in progress and receive early feedback on specific aspects of the codebase. This iterative approach promotes continuous improvement and helps identify potential issues or improvements earlier in the development cycle.