Introduction

Guides

Enforcing reviews

Depending on your goals and workflow, you may want to enforce reviews for all changes in your project, requiring an accepted Widgetbook review for each pull request with changes.

When Widgetbook Cloud reviews are enabled for your project, Widgetbook Cloud automatically creates a review for your PR and posts the URL in your GitHub PR as a commit status. If changes are requested, the commit status reflects the Widgetbook review status on your PR. However, GitHub's default configuration allows PRs to be merged even if status checks are not passing or still pending.

Example of a pending review not blocking the merge of the PR.

To enforce reviews for all changes in your project, you can set up a branch protection rule in your GitHub repository. This prevents PRs from being merged until the Widgetbook review is accepted.

  • Open the rulesets settings page

    Navigate to the repository settings in GitHub. In the navigation, click on Rules to open the accordion. Then click on Rulesets to open the rulesets page.

  • Create a new ruleset

    Click on New ruleset and create a new branch ruleset.

  • Set name

    Set a name for the new ruleset. For instance, set it to Widgetbook Review.

  • Activate rule

    Set the enforcement status to Active.

  • Create new target

    Scroll down to the Targets section and click on Create target. Select the branch you want to protect. We recommend choosing Include default branch, but depending on your workflow you may want to choose one or multiple branches.

  • Require status checks to pass

    Scroll down to the rules section. Disable the pre-selected rules. Once everything is deselected, enable the rule Require status checks to pass.

  • Add Widgetbook status check

    To make the Widgetbook Review commit status required, click the Add checks button. In the search box, copy the name of the Widgetbook review status check, which is formatted as Widgetbook Review (<widgetbook-project-name>). If you already have a pull request with a Widgetbook Review commit status, you can also obtain the name from the status checks section in the PR.

    In the example above, the status check is named Widgetbook Review (widgetbook-explained).

    In the search box, select the item that is shown.

    Once the dropdown menu is deselected, the check will be added.

  • Add a check source

    If no source is configured, select the Widgetbook app as the source.

  • Create the branch ruleset

    At the bottom of the page, click the Create button.

  • Verify ruleset

    Navigate to a PR to verify that the Widgetbook Review status check is now required to merge the PR.