Skip to content

Enforce conventional commits on PR titles #396

@lucabello

Description

@lucabello

There is a Github setting in the branch Ruleset that allows to:

Restrict commit metadata
Restrict commit author email addresses, committer email addresses, commit message content, and other metadata

This in turn allows us to set a regex that all PR titles (or commmits) to a default branch must follow. We can use this to enforce our PR titles to follow Conventional Commits.

What we need to do (in canonical-repo-automation):

  1. Switch away from classic branch protection rules to Rulesets;
  2. Force "Squash" of PR commits when merging
  3. Add the regex to filter conventional commits

The regex doesn't need to fully capture the Conventional Commits spec, but it should nudge us towards the correct PR titles. Importantly, we need to be able to capture a few different commit types, plus the optional ! for breaking changes.

This is needed mostly for clean auto-generated release notes, and to easily spot breaking changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions