-
Notifications
You must be signed in to change notification settings - Fork 114
chore: add github pr title check github action workflow #610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughNew 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
Sequence DiagramsequenceDiagram
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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this 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-nodewill 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.jsonorpackage.jsonto exist in the repository root for the cache to work effectively.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 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.
Summary by CodeRabbit