Skip to content

feat(pr): add PR title checker to enforce naming conventions#513

Merged
Miou-zora merged 6 commits intoEngineSquared:mainfrom
eliotttesnier:main
Mar 25, 2026
Merged

feat(pr): add PR title checker to enforce naming conventions#513
Miou-zora merged 6 commits intoEngineSquared:mainfrom
eliotttesnier:main

Conversation

@eliotttesnier
Copy link
Contributor

@eliotttesnier eliotttesnier commented Mar 24, 2026

Pull Request

Description

This PR introduces add workflow to validate pull request title format

Related Issues

Fixes #150

Type of Change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Performance improvement
  • Code refactoring
  • Build/CI configuration change

Changes Made

List the main changes in this PR:

  • Added the workflow to check pull request name

Testing

Describe the tests you ran to verify your changes:

  • Unit tests pass (xmake test)
  • Code follows the project's style guidelines (clang-format)
  • Manual testing performed (describe what you tested) -> CI

Test Environment

  • OS: Fedora 42
  • Compiler: gcc
  • Vulkan SDK Version: [e.g. 1.3.268.0]

Screenshots/Videos (if applicable)

Add screenshots or videos to help explain your changes.

Documentation

  • I have updated the relevant documentation
  • I have added/updated comments in the code
  • No documentation changes are required

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Breaking Changes

If this PR introduces breaking changes, describe them here and provide migration instructions.

Additional Notes

Any additional information that reviewers should know.

Summary by CodeRabbit

  • Chores
    • Added an automated CI check that validates pull request titles to enforce the format "type" or "type(scope): summary".
    • Validation enforces an allowed type, optional scope, a ": " separator, a non-empty summary that starts with a lowercase letter and does not end with a period; invalid titles cause the check to fail.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 24, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7cabd604-f8b0-4c83-8788-361a337cf31a

📥 Commits

Reviewing files that changed from the base of the PR and between c348806 and 2e446ee.

📒 Files selected for processing (1)
  • .github/workflows/pr_title_check.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/pr_title_check.yml

📝 Walkthrough

Walkthrough

Adds a GitHub Actions workflow and a Python script to validate pull request titles against a Conventional Commit-style pattern (<type>(<scope>): <summary>); the workflow runs on PR events and fails when titles violate type, scope, or summary rules.

Changes

Cohort / File(s) Summary
CI Workflow
.github/workflows/pr_title_check.yml
New GitHub Actions workflow triggered on pull_request events (opened, edited, synchronize, reopened) that runs a containerized job (python:3.14-slim) to execute the PR title validation script.
PR Title Validation Script
.github/scripts/pr_title_check.py
New Python script that reads PR_TITLE from the environment, parses and validates header (<type> or <type>(<scope>)) and summary rules, emits GitHub Actions-style ::error annotations on failure, and exits nonzero on invalid titles.

Sequence Diagram(s)

sequenceDiagram
    participant GitHub as GitHub (PR event)
    participant Actions as GitHub Actions
    participant Container as "python:3.14-slim" container
    participant Script as pr_title_check.py

    GitHub->>Actions: pull_request opened/edited/synchronize/reopened
    Actions->>Container: start job (validate-pr-title)
    Container->>Script: set PR_TITLE env and run script
    Script->>Script: parse header and summary, validate rules
    alt title valid
        Script-->>Container: exit 0 (success)
        Container-->>Actions: job succeeds
    else title invalid
        Script-->>Container: emit ::error annotation and exit 1
        Container-->>Actions: job fails
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped into CI's light,
checking titles day and night,
types and scopes in tidy rows,
no stray dots where none should go —
hop on, PRs, and write it right! 🥕

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The implementation adds the requested GitHub Actions workflow and validation script but uses a different format (type(scope): summary) than the issue's specified regex (^\[FEATURE\]|^\[BUG\]|^\[TASK\]). Update the validation script to enforce the regex pattern specified in issue #150 (^\[FEATURE\]|^\[BUG\]|^\[TASK\]) instead of the conventional commit format.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title directly matches the main objective: adding a PR title checker to enforce naming conventions, which is clear and specific.
Out of Scope Changes check ✅ Passed All changes are directly within scope: the workflow file and validation script together implement the requirement from issue #150 with no unrelated modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/pr_title_check.yml:
- Line 27: The workflow echoes untrusted PR_TITLE directly into GitHub Actions
workflow commands (the echo that emits ::error), which risks command injection;
update the echo calls that reference PR_TITLE to either wrap the user-controlled
output with GitHub Actions stop-commands (emit ::stop-commands:: before printing
the raw title and ::start-commands:: after) or remove the title from the ::error
payload entirely so no unescaped user input is passed to the ::error command;
locate the echo lines that interpolate PR_TITLE and replace them with the
stop-commands approach or a safe static message.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fdd7a75e-ee49-4bb5-993a-0d49bbd4a021

📥 Commits

Reviewing files that changed from the base of the PR and between 1b78b61 and d1fecb3.

📒 Files selected for processing (1)
  • .github/workflows/pr_title_check.yml

@Miou-zora Miou-zora changed the title feat(pr): add PR title checker to enforce naming conventions feat(pr): add PR title checker to enforce naming conventions. Mar 24, 2026
@Miou-zora Miou-zora changed the title feat(pr): add PR title checker to enforce naming conventions. feat(pr): add PR title checker to enforce naming conventions Mar 24, 2026
@sonarqubecloud
Copy link

@eliotttesnier eliotttesnier requested a review from Miou-zora March 24, 2026 22:51
@Miou-zora Miou-zora merged commit 33c632b into EngineSquared:main Mar 25, 2026
18 checks passed
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.

[FEATURE] Add a CI action to validate PR naming convention

2 participants