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.
Adding branch protections¶
Go to the repository settings by clicking on the Settings tab from a repository’s GitHub homepage.
Click on the Branches tab in the left-hand menu.
Click on the Add rule button.
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).
Click on the Create button.