Skip to content

GitHub pull request flow

GitHub’s code review tools include:

  • Inline commenting on code, making reviews easier to follow, and sharing feedback more directly.
  • More control over deployments to production. Code is deployed right after merging, so developers have control over staging changes and deploying whenever they are ready.
  • Rollbacks/reversions with the GitHub one-click method to revert pull requests.

GitHub flow for production environments

The GitHub flow is a branch-based workflow that streamlines reviews and deployment. This is a what a typical flow looks like for a production environment tracking the production branch:

  1. To work on a bug fix or new feature, create and switch to a new branch locally.
  2. Develop, make changes, commit, and as desired push up the branch.
  3. When the branch is ready for code review, open a pull request against the production branch.
  4. All Pull Requests to the production branch will be automatically scanned by the VIP Code Analysis Bot against VIP Coding Standards.
  5. Once all issues reported by the VIP Code Analysis Bot have been addressed and approved, the branch may merge to the production branch at the customer’s convenience. Merging to the production branch triggers an automatic deployment to the production site. GitHub has documentation on how to merge a pull request.

GitHub allows any number of approvals against a pull request, so teams can also utilize this approvals workflow if desired. Note, however, that GitHub will allow users to merge a pull request to the deployment branch once the pull request has any approvals.

GitHub flow for non-production environments

VIP highly recommends following the above GitHub Flow for development non-production environments as well. An example workflow on a develop environment could look something like:

  1. Create local feature branch (e.g. add/new-feature).
  2. Develop, test, and commit changes to the local branch.
  3. Push up the changes to a new remote branch.
  4. Create a pull request from the remote add/new-feature branch against the develop branch.
  5. It is optional but recommended to perform an Internal team code review.
  6. Merge the pull request and test it on develop environment.
  7. If everything looks good, create a pull request from the remote add/new-feature branch to the production branch.

Automated reviews

VIP Code Analysis Bot runs automatically on any open pull request (targeting any branch) when the pull request is opened or following any new commit. Depending on the size of the change, it may take a few minutes for feedback from the Bot to appear. If there are no issues in the Bot’s automated scan, it will not add any review notes.

Deactivated merge button

Branch protection rules can cause the merge button to remain deactivated until all reviews pass or are dismissed. Check if any previous reviews from the VIP Code Analysis Bot (or another reviewer) still needs to be addressed or if a review can be dismissed. Github documentation has instructions for dismissing a pull request review.

Rollbacks

If there are any issues with the deployment, GitHub provides a one-click option to “revert” pull requests.

A rollback to a previous commit can also be performed in the Deployments panel of the VIP Dashboard for an environment.

Last updated: December 28, 2023

Relevant to

  • Node.js
  • WordPress