Skip to content

Conversation

@lukeocodes
Copy link
Contributor

@lukeocodes lukeocodes commented Oct 21, 2025

Summary by CodeRabbit

  • Chores
    • Implemented automated pull request title validation to enforce standardized commit message conventions, including required type prefixes, proper formatting, and character limits.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 21, 2025

Walkthrough

New commitlint configuration file enforces conventional commit message rules. GitHub Actions workflow automatically validates pull request titles against these rules when PRs are opened, edited, synchronized, or reopened.

Changes

Cohort / File(s) Summary
Commit validation setup
​.github/.commitlintrc.json, ​.github/workflows/pr-title-check.yml
Added commitlint configuration extending @commitlint/config-conventional with rules for type, scope, subject formatting and header length. Added GitHub Actions workflow triggering on PR events to validate titles using commitlint against the configuration.

Sequence Diagram

sequenceDiagram
    participant GitHub
    participant Workflow as pr-title-check workflow
    participant commitlint
    
    GitHub->>Workflow: PR opened/edited/synchronized/reopened
    Workflow->>Workflow: Checkout repo & setup Node.js
    Workflow->>Workflow: Install commitlint dependencies
    Workflow->>commitlint: Validate PR title against .commitlintrc.json
    
    alt Validation passes
        commitlint-->>Workflow: Exit 0
        Workflow-->>GitHub: ✓ Check passed
    else Validation fails
        commitlint-->>Workflow: Exit 1
        Workflow-->>GitHub: ✗ Check failed
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

✅ 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 "chore: add github pr title check github action workflow" is clearly related to the main changes in the changeset. The pull request adds two files: a commitlint configuration file (.github/.commitlintrc.json) and a GitHub Actions workflow (.github/workflows/pr-title-check.yml) that validates PR titles using commitlint. The title accurately describes the primary change—introducing a GitHub Actions workflow for PR title checking. While the title has some minor redundancy (the word "github" appears twice), it is nonetheless specific and clear enough that a teammate scanning the history would quickly understand the primary change.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch lo/add-pr-title-check-workflow

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

🧹 Nitpick comments (1)
.github/workflows/pr-title-check.yml (1)

24-26: Consider adding npm cache to optimize workflow performance.

The workflow reinstalls commitlint dependencies on every PR event. Enabling npm cache via actions/setup-node will avoid redundant downloads and speed up the workflow.

Apply this diff to cache npm dependencies:

             - name: Setup Node.js
               uses: actions/setup-node@v4
               with:
                   node-version: "20"
+                  cache: "npm"

Note: This requires a package-lock.json or package.json to exist in the repository root for the cache to work effectively.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 37ca15d and bfda5ef.

📒 Files selected for processing (2)
  • .github/.commitlintrc.json (1 hunks)
  • .github/workflows/pr-title-check.yml (1 hunks)
🔇 Additional comments (2)
.github/.commitlintrc.json (1)

1-52: Configuration structure is sound.

The commitlint config follows best practices, extends the conventional commit standard, and enforces sensible constraints (100-character header, lower-case types/scopes, required subject/type). The rule severity levels are consistently set to error (2), which is appropriate for blocking non-compliant PRs.

.github/workflows/pr-title-check.yml (1)

3-14: Workflow triggering and setup look good.

The PR event triggers (opened, edited, synchronize, reopened) comprehensively cover the PR lifecycle, ensuring validation occurs whenever the title might change. Runner selection and action versions are appropriate.

@lukeocodes lukeocodes merged commit b85b3cc into main Oct 21, 2025
15 checks passed
@lukeocodes lukeocodes deleted the lo/add-pr-title-check-workflow branch October 21, 2025 20:01
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.

2 participants