ci: Add GH workflow to validate PR titles follow Conventional Commits.#1
Conversation
WalkthroughA new GitHub Actions workflow file named Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant GitHub
participant Action
User->>GitHub: Open/Edit/Reopen PR
GitHub->>Action: Trigger `pr-title` workflow
Action->>Action: Check commit message standards
Action->>GitHub: Return results
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
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.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (1)
.github/workflows/pr-title.yaml (1)
17-23: Consider using major version tagWhile pinning to a specific version (
v5.5.3) provides stability, consider using the major version tag (v5) to automatically receive compatible updates, including security patches.Apply this change:
- - uses: "amannn/action-semantic-pull-request@v5.5.3" + - uses: "amannn/action-semantic-pull-request@v5"
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- .github/workflows/pr-title.yaml (1 hunks)
🧰 Additional context used
🔇 Additional comments (3)
.github/workflows/pr-title.yaml (3)
3-6: LGTM! Safe usage of pull_request_targetThe trigger configuration is appropriate for this use case. Using
pull_request_targetinstead ofpull_requestis correct here since:
- We're only using a trusted action
- We need the workflow to run on PRs from forks
- We're not checking out or executing any code from the PR
8-9: LGTM! Follows principle of least privilegeThe permissions are correctly configured to the minimum required level (
read) for pull requests.
21-23: Verify conventional commit configuration requirementsThe action is using default settings for allowed types, scopes, and other validation rules. Consider if you need to customize these to match your project's commit message guidelines.
Let's check if the repository has existing commit message guidelines:
✅ Verification successful
Let me check for any other conventional commit configuration or guidelines in the repository:
Let me do one final check to see if there are any existing commit messages that might indicate the project's conventions:
Default conventional commit configuration is appropriate for this project
Based on the investigation:
- This is a new project with only initial commits
- The PR title validation workflow was just added
- No existing commit message guidelines or configurations were found
- The commit messages already follow conventional commit format (e.g., "ci: Add GH workflow...")
Using the default configuration of
action-semantic-pull-requestis actually a good starting point as it enforces the standard conventional commit types without being overly restrictive. As the project evolves, the team can add custom configurations if needed.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Look for commit message guidelines in common locations echo "Checking for commit message guidelines..." rg -i "commit.*(message|style|convention)" README.md || true rg -i "conventional.?commit" README.md || true echo "Checking for commit-related configuration..." fd "commitlint" --type f fd "commit-msg" --type fLength of output: 451
Script:
#!/bin/bash # Look for other common locations and formats of commit conventions # Check for package.json commitlint config echo "Checking package.json for commit-related configs..." fd "package.json" --type f --exec grep -l "commit\|conventional" {} \; --exec cat {} \; # Check for any other potential config files echo -e "\nChecking for other config files..." fd -e yml -e yaml -e json -e js -e config.js --exec grep -l "commit\|conventional" {} \; # Check for PR templates that might contain commit guidelines echo -e "\nChecking PR templates..." fd "pull_request_template" --type f fd "PULL_REQUEST_TEMPLATE" --type fLength of output: 522
Script:
#!/bin/bash # Check recent commit messages for patterns echo "Analyzing recent commit messages..." git log -n 10 --pretty=format:"%s" # Check if semantic PR action is used elsewhere echo -e "\nChecking for other semantic PR configurations..." rg "amannn/action-semantic-pull-request" -A 5 -B 5Length of output: 419
| concurrency: | ||
| group: "${{github.workflow}}-${{github.ref}}" | ||
|
|
||
| # Cancel in-progress jobs for efficiency | ||
| cancel-in-progress: true |
There was a problem hiding this comment.
Fix YAML indentation
The cancel-in-progress key should be aligned with the group key under concurrency.
Apply this fix:
concurrency:
group: "${{github.workflow}}-${{github.ref}}"
-
- # Cancel in-progress jobs for efficiency
- cancel-in-progress: true
+ 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: true |
There was a problem hiding this comment.
They are aligned, but you're suggesting removing the comment, which doesn't make sense.
There was a problem hiding this comment.
@kirkrodrigues, you're absolutely right. I apologize for the confusion. The keys are correctly aligned, and my previous suggestion was incorrect. Please disregard it.
✏️ Learnings added
Learnt from: kirkrodrigues
PR: y-scope/spider#1
File: .github/workflows/pr-title.yaml:11-15
Timestamp: 2024-10-23T02:23:12.040Z
Learning: Ensure to carefully check YAML indentation before suggesting fixes, and avoid removing comments unless necessary.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
|
@coderabbitai configuration |
CodeRabbit configurationlanguage: en-CA
tone_instructions: ''
early_access: false
enable_free_tier: true
reviews:
profile: chill
request_changes_workflow: false
high_level_summary: true
high_level_summary_placeholder: '@coderabbitai summary'
auto_title_placeholder: '@coderabbitai'
review_status: true
commit_status: true
poem: false
collapse_walkthrough: false
sequence_diagrams: true
changed_files_summary: true
labeling_instructions: []
path_filters: []
path_instructions: []
abort_on_close: true
auto_review:
enabled: true
auto_incremental_review: true
ignore_title_keywords: []
labels: []
drafts: false
base_branches: []
tools:
shellcheck:
enabled: true
ruff:
enabled: true
markdownlint:
enabled: true
github-checks:
enabled: true
timeout_ms: 90000
languagetool:
enabled: true
enabled_only: false
level: default
biome:
enabled: true
hadolint:
enabled: true
swiftlint:
enabled: true
phpstan:
enabled: true
level: default
golangci-lint:
enabled: true
yamllint:
enabled: true
gitleaks:
enabled: true
checkov:
enabled: true
detekt:
enabled: true
eslint:
enabled: true
rubocop:
enabled: true
buf:
enabled: true
regal:
enabled: true
actionlint:
enabled: true
pmd:
enabled: true
cppcheck:
enabled: true
semgrep:
enabled: true
circleci:
enabled: true
chat:
auto_reply: true
knowledge_base:
opt_out: false
learnings:
scope: auto
issues:
scope: auto
jira:
project_keys: []
linear:
team_keys: []
pull_requests:
scope: auto
|
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.
Validation performed
Summary by CodeRabbit
New Features
Chores