How to add GitHub branch protections to a Times Square repository

On every pull request, Times Square runs GitHub status checks that validate the YAML configuration files and that executes the notebooks to validate that they run without errors. You should protect the default branch (typically main) to ensure that these checks pass before allowing a pull request to be merged. To perform this configuration, you need to be an administrator of the GitHub repository.

Screenshot of the status checks on a pull request, including the "Notebook execution" and "YAML config validation" checks performed by Times square.

Example status checks on a pull request. The “Notebook execution” and “YAML config validation” checks are performed by Times Square.

Adding branch protections

  1. Go to the repository settings by clicking on the Settings tab from a repository’s GitHub homepage.

  2. Click on the Branches tab in the left-hand menu.

  3. Click on the Add rule button.

  4. Set the rules:

    • Branch name pattern: main (or the name of your default branch)

    • Enable the following rules:

      • Require a pull request before merging

      • Require status checks to pass before merging

      • Require branches to be up to date before merging

    • Enable the following status checks (these checks only autocomplete after they have been run at least once):

      • YAML config validation

      • Notebook execution

    You can also enable or configure other rules as needed. For example, if you have a GitHub Actions workflow that runs Pre-commit checks, you can add it to the list of required status checks (see Setting up pre-commit hooks to format notebooks).

  5. Click on the Create button.

Screenshot of the branch protection settings for a repository.

Example branch protection settings for a repository following the guidelines described above.