-
Notifications
You must be signed in to change notification settings - Fork 2
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
ci: Add GH workflow to validate that PR titles follow Conventional Commits. #2
ci: Add GH workflow to validate that PR titles follow Conventional Commits. #2
Conversation
WalkthroughA new GitHub Actions workflow file named Changes
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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: 2
🧹 Outside diff range and nitpick comments (1)
.github/pr-title-checks.yaml (1)
28-30
: Consider documenting supported commit types.
While the configuration is correct, it would be helpful to document the supported commit types in comments or in the repository's contributing guidelines. The action also supports customizing error messages and allowed types through optional inputs.
Add documentation above the step:
steps:
+ # Validates PR titles against Conventional Commits spec
+ # Supported types: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert
+ # For more options, see: https://github.com/amannn/action-semantic-pull-request#configuration
- uses: "amannn/action-semantic-pull-request@v5"
env:
GITHUB_TOKEN: "${{secrets.GITHUB_TOKEN}}"
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- .github/pr-title-checks.yaml (1 hunks)
🔇 Additional comments (2)
.github/pr-title-checks.yaml (2)
14-16
: LGTM! Well-configured permissions.
The permissions follow security best practices by implementing the principle of least privilege, requesting only the minimal "read" access required for the semantic PR action.
1-30
: LGTM! Implementation aligns perfectly with PR objectives.
The workflow successfully implements PR title validation using Conventional Commits specification while properly handling external contributor permissions. The configuration is secure and efficient.
pull_request_target: | ||
branches: ["main"] | ||
types: ["edited", "opened", "reopened"] |
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.
🛠️ Refactor suggestion
Consider adding "synchronize" to trigger types.
The workflow currently triggers on "edited", "opened", and "reopened" events. Adding "synchronize" would ensure the title is validated when PRs are updated with new commits.
pull_request_target:
branches: ["main"]
- types: ["edited", "opened", "reopened"]
+ types: ["edited", "opened", "reopened", "synchronize"]
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
pull_request_target: | |
branches: ["main"] | |
types: ["edited", "opened", "reopened"] | |
pull_request_target: | |
branches: ["main"] | |
types: ["edited", "opened", "reopened", "synchronize"] |
concurrency: | ||
group: "${{github.workflow}}-${{github.ref}}" | ||
|
||
# Cancel in-progress jobs for efficiency | ||
cancel-in-progress: true |
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.
Fix YAML indentation for cancel-in-progress.
The cancel-in-progress
property should be aligned with the group
property under concurrency
.
concurrency:
group: "${{github.workflow}}-${{github.ref}}"
-
- # Cancel in-progress jobs for efficiency
- cancel-in-progress: true
+ # Cancel in-progress jobs for efficiency
+ cancel-in-progress: true
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
concurrency: | |
group: "${{github.workflow}}-${{github.ref}}" | |
# Cancel in-progress jobs for efficiency | |
cancel-in-progress: true | |
concurrency: | |
group: "${{github.workflow}}-${{github.ref}}" | |
# Cancel in-progress jobs for efficiency | |
cancel-in-progress: true |
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.
All changes make sense. But how does it get tested before this PR get merged? I guess only the PR get merged then we can use a different test PR to test this change?
Yeah, you can only test it after merging the PR. So that's why in y-scope/spider#1, I validated it as follows:
|
Description
Convention Commits is a specification for writing commit messages (or in our case, PR titles) that makes it easy to see at a glance what change the commit makes which in turn makes it easier to generate release notes.
This PR adds a workflow to check PR titles match the spec. Specifically, we use the amannn/action-semantic-pull-request action which defaults to using the types specified in commitizen/conventional-commit-types.
NOTE :This PR is a copy of y-scope/spider#1 but with additional comments in the workflow file.
Validation performed
This specific PR hasn't been validated but the code was validated in y-scope/spider#1.
Summary by CodeRabbit
New Features
Chores