Skip to content

Conversation

github-learning-lab[bot]
Copy link

In this pull request, I've added some tests to help ensure the project builds. This is one example of how you can customize specific validations to run when your CI starts a build. I need you to add a run action to your .circleci/config.yml file.

In this example, we'll build the project with bundle exec jekyll build. Depending on the programming language and project, you might use a different command, like yarn run android or nvm package. You can find more specific information on CircleCI configuration in their documentation.

Step 5: Add validation

Build your site.

⌨️ Activity: Add some automated validation to your project

  1. In this pull request, add the following code to the placeholder in your .circleci/config.yml file. You can do this by editing the file from the Files changed tab, or by scrolling down and accepting the suggested change.
 bundle exec jekyll build
  1. Commit your change.

I'll respond below with your next step.

Sometimes I respond too fast for the page to update! If you perform an expected action and don't see a response, wait a few seconds and refresh the page for your next steps.

@github-learning-lab github-learning-lab bot mentioned this pull request Feb 18, 2022
Co-authored-by: github-learning-lab[bot] <37936606+github-learning-lab[bot]@users.noreply.github.com>
@github-learning-lab
Copy link
Author

Now that you've added some validation tests to your CI build, it's time to turn on branch protection. Protected branches ensure that collaborators cannot make irrevocable changes to specific branches. This also allows you to enable CI required status checks to pass before merging.

Why use protected branches? Protected branches allow contributors to create branches and pull requests in your repository, while making sure those changes are throughly vetted before merging. When a repository employs a continuous integration service like CircleCI, branches can be protected based on their build statuses so the review process can be largely automated, giving contributors self-efficacy. Project maintainers also benefit by focusing their attention on gray areas and processes that can't be easily automated.

screen shot 2018-12-13 at 3 32 04 pm

I've changed the protections for the main branch throughout the course so far to help keep you on track. Now, it's time for you to make some changes.

Step 6: Protect the main branch

⌨️ Activity: Protect a branch based on the CI build status

  1. Navigate to the Branches section of the Settings for this repository.
  2. Under Branch protection rules, click the Edit button next to main.
  3. Select Require status checks to pass before merging.
  4. Uncheck Require branches to be up to date before merging.
    • This is automatically checked, and can be a good idea. For this project, we'll uncheck it to reduce the extra commits and builds.
  5. Select the ci/circleci:build option.
  6. Click Save changes.
  7. Return to your pull request and Approve the pull request.

I'll respond below with your next step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants