ci: add PR title linting#1166
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds Conventional Commits rules, a Node 24 local GitHub Action that validates pull request titles, and a workflow triggered when pull requests are opened, edited, or reopened. ChangesPR title linting
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant PullRequest
participant lint-pr-title.yml
participant lint-pr-title
participant commitlint.config.mjs
PullRequest->>lint-pr-title.yml: opened, edited, or reopened event
lint-pr-title.yml->>lint-pr-title: execute local action
lint-pr-title->>commitlint.config.mjs: load rules
commitlint.config.mjs-->>lint-pr-title: return rules
lint-pr-title-->>lint-pr-title.yml: pass or set failed
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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.
Actionable comments posted: 2
🧹 Nitpick comments (1)
.github/workflows/lint-pr-title.yml (1)
32-34: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winPrefer
npm ciovernpm installin CI environments.Using
npm installcan result in non-deterministic builds because it might update yourpackage-lock.jsonor install different dependency versions. For CI environments, it's highly recommended to commit thepackage-lock.jsonfile for the action and usenpm cito ensure reproducible dependency resolution.♻️ Proposed refactor
- name: Install action dependencies - run: npm install --ignore-scripts + run: npm ci --ignore-scripts working-directory: .github/actions/lint-pr-title🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/lint-pr-title.yml around lines 32 - 34, Update the “Install action dependencies” step in the lint-pr-title workflow to use npm ci instead of npm install, while preserving the existing --ignore-scripts flag and working-directory.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/actions/lint-pr-title/src/index.js:
- Around line 30-33: Update the lint call in the action’s main flow to pass the
resolved parserOpts from load() into `@commitlint/lint` alongside config.rules,
defaultIgnores, and helpUrl. Reuse the parser options already returned or
resolved by load(), ensuring PR titles are parsed with the configured grammar.
In @.github/workflows/lint-pr-title.yml:
- Around line 24-25: Update the actions/checkout step in the PR-title lint
workflow to explicitly disable credential persistence using the checkout
action’s persist-credentials setting. Leave the existing pinned action version
and other checkout behavior unchanged.
---
Nitpick comments:
In @.github/workflows/lint-pr-title.yml:
- Around line 32-34: Update the “Install action dependencies” step in the
lint-pr-title workflow to use npm ci instead of npm install, while preserving
the existing --ignore-scripts flag and working-directory.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 7cc002a3-e11f-45c7-bc03-062555c82d9e
📒 Files selected for processing (5)
.github/actions/lint-pr-title/action.yml.github/actions/lint-pr-title/package.json.github/actions/lint-pr-title/src/index.js.github/workflows/lint-pr-title.ymlcommitlint.config.mjs
cef9df7 to
3c6fcfc
Compare
Summary
lint-pr-title) with commitlintcommitlint.config.mjsat the repo root with standard type rulesSummary by CodeRabbit