Skip to content

Conversation

@lsorber
Copy link
Member

@lsorber lsorber commented Jun 15, 2025

Changes:

  1. Add PR title validation to the root repo.
  2. Add PR title validation to the Cookiecutter template, conditional on Conventional Commits being enabled.
  3. Add PR title validation to the Copier template, conditional on Conventional Commits being enabled.

Partially addresses #267.

EDIT: I experimented with GitHub Repository Settings and the .github/settings.yml below, but it's apparently quite flakey (cf. repository-settings/app#967) and also a security risk. It appears it's probably best to just set these settings manually after setting up a repo.

repository:
  default_branch: main
  allow_merge_commit: false
  allow_rebase_merge: false
  allow_squash_merge: true
  squash_merge_commit_title: PR_TITLE
  squash_merge_commit_message: PR_BODY
  delete_branch_on_merge: true

branches:
  - name: main
    protection:
      required_pull_request_reviews:
        required_approving_review_count: 1
        dismiss_stale_reviews: false
        require_code_owner_reviews: false
        dismissal_restrictions: null
        bypass_pull_request_allowances: null
        require_last_push_approval: false
      required_status_checks: null
      required_conversation_resolution: true
      required_signatures: true
      required_linear_history: true
      enforce_admins: null
      restrictions: null

@lsorber lsorber requested a review from sinopeus June 15, 2025 16:01
@lsorber lsorber self-assigned this Jun 15, 2025
Copilot AI review requested due to automatic review settings June 15, 2025 16:01
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces PR title validation to the repository and its templates to ensure that commits follow Conventional Commits. The changes include:

  • Adding a new GitHub Actions workflow (pr.yml) in the root repository.
  • Adding a conditional pr.yml workflow to the Cookiecutter and Copier templates.
  • Conditionally removing the pr.yml file from the generated project when Conventional Commits are not enabled.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
{{ cookiecutter.__project_name_kebab_case }}/.github/workflows/pr.yml Adds a workflow to validate PR titles using uvx and commitizen.
template/{% if ci == 'github' %}.github{% endif %}/workflows/{% if with_conventional_commits %}pr.yml{% endif %}.jinja Provides a template for the PR workflow conditional on Conventional Commits being enabled.
hooks/post_gen_project.py Modifies project generation to remove the pr.yml workflow if Conventional Commits are not enabled.
.github/workflows/pr.yml Adds a workflow to validate PR titles in the repository.

@PGerardi
Copy link
Contributor

PGerardi commented Sep 9, 2025

Validated the changes https://github.com/superlinear-ai/my-project/actions/runs/17588466127, works like a charm 🎉

Copy link
Contributor

@PGerardi PGerardi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lsorber lsorber merged commit e610016 into main Sep 10, 2025
24 checks passed
@lsorber lsorber deleted the ls-check-pr-title branch September 10, 2025 07:59
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.

3 participants