Skip to main content
Last Reviewed: May 08, 2020

Pull Request/Merge Request Workflow

In step three of the Build Tools guide, learn how to use pull requests as part of your workflow.


Pull Request/Merge Request Introduction

This section demonstrates the Build Tools project workflow by making a code change on a Git feature branch and opening a pull request (GitHub) or merge request (GitLab) to accept that change into the master branch.

As a reminder, these examples use GitHub as the code repository with CircleCI as the CI. CircleCI builds the full site artifact and deploys it to the project's Pantheon site. Substitute the Git provider and CI below with the right ones for your project.

Branches with an associated pull request are built and deployed to a Pantheon Multidev environment, with the pull request number being used to construct the Multidev name. For example, pull request 12 will be deployed to a Pantheon Multidev named pr-12.

The master branch is automatically built and deployed to the Pantheon dev environment. This happens both when you commit code directly to the master branch and when a pull request is merged into the master branch.

Continuous delivery diagram shows the Master branch going to Dev, and the PR going to a Multidev

Deployments to the test and live environments on Pantheon must still be done manually, either through the Dashboard or via Terminus. For this reason, Continuous Delivery (CD)

is not enabled.

Create a Pull Request

  1. From your GitHub project page, click on the config directory. Select the file system.site.yml and click to open an editor:

    system.site.yml file open in GitHub

  2. Change the slogan to something inspiring:

    Slogan edited to say 'Making the world amazing'

  3. Scroll down and enter a message describing this change in the Commit changes area. Then click on the radio button to create a new branch and give it a short name, like slogan. Click Propose file change:

    Create 'slogan' branch

  4. Click Create Pull Request:

    Slogan Pull Request

    Builds

    As soon as you commit changes to a feature branch, CircleCI builds a new Multidev environment on Pantheon to preview the change. Once the Multidev environment has been created, the build script will add a comment to the commit with links to the Multidev environment of the Pantheon Site Dashboard and a button to visit the Multidev site URL (e.g., pr-1-my-pantheon-project.pantheonsite.io). The Pull Request page conveniently shows the messages from each commit on the branch:

    Passed Pull Request has 'Visit Site' button

    Automated Tests

    It is also common to set up automated tests to confirm that the project is working as expected; when tests are available, GitHub will run them and display the results of the tests with the pull request. Working on projects with comprehensive tests increases the development team's confidence that submitted pull requests will work correctly when they are integrated into the main build.

  5. Wait for the build on CircleCI to leave a comment, then click on the Visit Site button to access the Multidev site URL. Note that the slogan you entered in your pull request branch has been imported and is visible in the site header:

    Site initial login

    This Multidev environment will persist for as long as the pull request remains open in GitHub.

  6. Enter the admin username and password you created in the build-env:create-project command. Click Log in to access the admin interface:

    Site admin log in