Skip to content

Conversation

@AshharAhmadKhan
Copy link
Contributor

Overview

This PR adds an automated bot that comments on PRs when the conventional title check fails, providing helpful guidance to contributors.

Changes

  • Created .github/scripts/bot-conventional-pr-title.js - Bot script with intelligent title suggestions
  • Modified .github/workflows/pr-check-title.yml - Integrated bot to run on title check failure
  • Updated CHANGELOG.md - Added entry under [Unreleased] → Added section

Features

✅ Detects when PR title validation fails
✅ Shows current (invalid) title
✅ Suggests appropriate conventional type based on keywords
✅ Provides both UI and CLI instructions for fixing
✅ Prevents duplicate comments by updating existing ones
✅ Links to Conventional Commits documentation

Implementation Details

Bot Logic (bot-conventional-pr-title.js)

  • Analyzes PR title keywords to suggest appropriate conventional type
  • Priority order: format/style → docs → fix → test → refactor → ci → chore → perf → build
  • Searches for existing bot comments to prevent spam
  • Updates existing comment if found, creates new one otherwise
  • Comprehensive error handling and logging

Workflow Integration (pr-check-title.yml)

  • Added pull-requests: write permission for bot to comment
  • Triggers bot only when title check fails (if: failure())
  • Checks out repository to access bot script
  • Uses actions/github-script@v7 to run bot in workflow context

Related issue(s)

Fixes #1705

Notes for reviewer

This is a fresh, clean implementation created in response to PR #1710 being closed due to pollution.

Changes from previous PR:

  • ✅ Fresh branch from latest upstream/main (commit 11bb2f9)
  • ✅ Only 3 files changed (no pollution from other PRs)
  • ✅ Single clean commit with DCO sign-off
  • ✅ All 25 validation tests passing

Testing:

  • ✅ JavaScript syntax validated
  • ✅ YAML workflow syntax validated
  • ✅ Bot logic includes comprehensive error handling
  • ✅ Follows existing bot naming patterns (bot-*.js)
  • ✅ Uses pinned action versions for security
  • ✅ No unrelated Python/SDK files modified

What to test in this PR:

  1. The bot should comment when PR title lacks a conventional prefix
  2. The bot should suggest appropriate type based on title keywords
  3. The bot should update (not duplicate) comments if title changes
  4. Bot comment should include all required elements:
    • Current title display
    • Suggested format with type prefix
    • UI instructions
    • CLI instructions
    • Valid types list
    • Conventional Commits link

Checklist

  • Documented (comprehensive inline JSDoc comments)
  • Tested (25/25 validation tests passing)
  • Follows existing project conventions
  • CHANGELOG entry added
  • DCO and GPG signed commit
  • Based on latest upstream/main
  • Only bot-related files modified (no pollution)

Signed-off-by: Ashhar Ahmad Khan <145142826+AshharAhmadKhan@users.noreply.github.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 9, 2026

Walkthrough

Adds a new GitHub Actions bot script that analyzes PR titles for conventional-commit types, formats guidance messages, and posts or updates comments on PRs. Updates the PR title check workflow to invoke the script, support dry-run, and post guidance when the title check fails.

Changes

Cohort / File(s) Summary
Bot Script Implementation
​.github/scripts/bot-conventional-pr-title.js
New script that detects a suggested conventional type from a PR title, builds a Markdown guidance message, paginates PR comments, and creates or updates a bot comment. Exports run, suggestConventionalType, and formatMessage. Handles dry-run, 403 fork permission cases, and errors.
Workflow Integration
​.github/workflows/pr-check-title.yml
Workflow updated to invoke the new script on title check failure, added workflow_dispatch dry_run input, adjusted concurrency and permissions, renamed job/steps, added checkout-on-failure, and passes github, context, prNumber, prTitle, and computed dryRun to the script.
Changelog
CHANGELOG.md
Added entry documenting the automated bot that comments with guidance for invalid conventional commit PR titles.

Sequence Diagram

sequenceDiagram
    participant GitHub as GitHub
    participant Workflow as GitHub Actions Workflow
    participant BotScript as Bot Script
    participant API as GitHub REST API

    GitHub->>Workflow: PR event or workflow_dispatch
    activate Workflow
    Workflow->>BotScript: run(github, context, prNumber, prTitle, dryRun)
    activate BotScript
    BotScript->>BotScript: suggestConventionalType(prTitle)
    BotScript->>BotScript: formatMessage(prTitle, suggestedType, prNumber)
    BotScript->>API: GET /repos/.../issues/{prNumber}/comments (paginated)
    activate API
    API-->>BotScript: comments list
    deactivate API
    alt Existing bot comment found
        BotScript->>API: PATCH /repos/.../comments/{commentId}
    else No existing comment
        BotScript->>API: POST /repos/.../issues/{prNumber}/comments
    end
    activate API
    API-->>BotScript: comment created/updated
    deactivate API
    BotScript-->>Workflow: finished
    deactivate BotScript
    deactivate Workflow
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding a conventional PR title bot for automated feedback in CI, which aligns with the primary objective of the changeset.
Description check ✅ Passed The description comprehensively explains the changes, features, implementation details, and testing performed, all directly related to the bot implementation and workflow integration.
Linked Issues check ✅ Passed The PR fully addresses all requirements from issue #1705: detects conventional title check failures [#1705], posts bot comments with current title [#1705], provides conventional format guidance [#1705], includes UI/CLI instructions [#1705], and links to Conventional Commits docs [#1705].
Out of Scope Changes check ✅ Passed All three file changes are directly aligned with PR objectives: the bot script implements core logic, workflow integration enables bot execution on failure, and CHANGELOG entry documents the feature as required.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

No actionable comments were generated in the recent review. 🎉


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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 9, 2026

Walkthrough

Introduces a new GitHub Actions bot script that analyzes PR titles for conventional commit compliance, suggests improvements via keyword-based type detection, and automatically comments on PRs with helpful guidance. Updates the corresponding workflow to integrate the bot and provide user-friendly correction instructions.

Changes

Cohort / File(s) Summary
Bot Script Implementation
.github/scripts/bot-conventional-pr-title.js
New script (~300 lines) that analyzes PR titles, suggests conventional commit types via keyword matching, formats guidance messages with instructions and valid type list, and interacts with GitHub API to post or update PR comments with support for dry-run mode and robust error handling.
Workflow Integration
.github/workflows/pr-check-title.yml
Updated workflow to invoke the new bot script on title check failure, added workflow_dispatch dry_run input, renamed jobs and steps, updated concurrency configuration, and added repository checkout step for comment posting capabilities.
Changelog
CHANGELOG.md
Added entry documenting the new automated bot feature for providing PR title guidance.

Sequence Diagram

sequenceDiagram
    participant GitHub as GitHub
    participant Workflow as GitHub Actions Workflow
    participant BotScript as Bot Script
    participant API as GitHub API

    GitHub->>Workflow: PR event triggered
    activate Workflow
    Workflow->>BotScript: run(github, context, prNumber, prTitle, dryRun)
    activate BotScript
    BotScript->>BotScript: suggestConventionalType(prTitle)
    BotScript->>BotScript: formatMessage(title, suggestedType, prNumber)
    BotScript->>API: GET /repos/.../issues/prNumber/comments
    activate API
    API-->>BotScript: paginated comments list
    deactivate API
    alt Existing bot comment found
        BotScript->>API: PATCH /repos/.../comments/commentId
    else No existing comment
        BotScript->>API: POST /repos/.../issues/prNumber/comments
    end
    activate API
    API-->>BotScript: comment created/updated
    deactivate API
    BotScript-->>Workflow: success
    deactivate BotScript
    deactivate Workflow
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a conventional PR title bot for automated feedback on title validation failures.
Description check ✅ Passed The description is well-structured, clearly explaining the overview, changes, features, implementation details, and testing approach related to the bot implementation.
Linked Issues check ✅ Passed All requirements from issue #1705 are met: bot detects title check failures, displays current invalid title, suggests conventional types based on keywords, provides UI and CLI fix instructions, and includes Conventional Commits documentation link.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the bot implementation: bot script creation, workflow integration, and changelog entry. No unrelated modifications present.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

2 similar comments
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 9, 2026

Walkthrough

Introduces a new GitHub Actions bot script that analyzes PR titles for conventional commit compliance, suggests improvements via keyword-based type detection, and automatically comments on PRs with helpful guidance. Updates the corresponding workflow to integrate the bot and provide user-friendly correction instructions.

Changes

Cohort / File(s) Summary
Bot Script Implementation
.github/scripts/bot-conventional-pr-title.js
New script (~300 lines) that analyzes PR titles, suggests conventional commit types via keyword matching, formats guidance messages with instructions and valid type list, and interacts with GitHub API to post or update PR comments with support for dry-run mode and robust error handling.
Workflow Integration
.github/workflows/pr-check-title.yml
Updated workflow to invoke the new bot script on title check failure, added workflow_dispatch dry_run input, renamed jobs and steps, updated concurrency configuration, and added repository checkout step for comment posting capabilities.
Changelog
CHANGELOG.md
Added entry documenting the new automated bot feature for providing PR title guidance.

Sequence Diagram

sequenceDiagram
    participant GitHub as GitHub
    participant Workflow as GitHub Actions Workflow
    participant BotScript as Bot Script
    participant API as GitHub API

    GitHub->>Workflow: PR event triggered
    activate Workflow
    Workflow->>BotScript: run(github, context, prNumber, prTitle, dryRun)
    activate BotScript
    BotScript->>BotScript: suggestConventionalType(prTitle)
    BotScript->>BotScript: formatMessage(title, suggestedType, prNumber)
    BotScript->>API: GET /repos/.../issues/prNumber/comments
    activate API
    API-->>BotScript: paginated comments list
    deactivate API
    alt Existing bot comment found
        BotScript->>API: PATCH /repos/.../comments/commentId
    else No existing comment
        BotScript->>API: POST /repos/.../issues/prNumber/comments
    end
    activate API
    API-->>BotScript: comment created/updated
    deactivate API
    BotScript-->>Workflow: success
    deactivate BotScript
    deactivate Workflow
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a conventional PR title bot for automated feedback on title validation failures.
Description check ✅ Passed The description is well-structured, clearly explaining the overview, changes, features, implementation details, and testing approach related to the bot implementation.
Linked Issues check ✅ Passed All requirements from issue #1705 are met: bot detects title check failures, displays current invalid title, suggests conventional types based on keywords, provides UI and CLI fix instructions, and includes Conventional Commits documentation link.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the bot implementation: bot script creation, workflow integration, and changelog entry. No unrelated modifications present.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 9, 2026

Walkthrough

Introduces a new GitHub Actions bot script that analyzes PR titles for conventional commit compliance, suggests improvements via keyword-based type detection, and automatically comments on PRs with helpful guidance. Updates the corresponding workflow to integrate the bot and provide user-friendly correction instructions.

Changes

Cohort / File(s) Summary
Bot Script Implementation
.github/scripts/bot-conventional-pr-title.js
New script (~300 lines) that analyzes PR titles, suggests conventional commit types via keyword matching, formats guidance messages with instructions and valid type list, and interacts with GitHub API to post or update PR comments with support for dry-run mode and robust error handling.
Workflow Integration
.github/workflows/pr-check-title.yml
Updated workflow to invoke the new bot script on title check failure, added workflow_dispatch dry_run input, renamed jobs and steps, updated concurrency configuration, and added repository checkout step for comment posting capabilities.
Changelog
CHANGELOG.md
Added entry documenting the new automated bot feature for providing PR title guidance.

Sequence Diagram

sequenceDiagram
    participant GitHub as GitHub
    participant Workflow as GitHub Actions Workflow
    participant BotScript as Bot Script
    participant API as GitHub API

    GitHub->>Workflow: PR event triggered
    activate Workflow
    Workflow->>BotScript: run(github, context, prNumber, prTitle, dryRun)
    activate BotScript
    BotScript->>BotScript: suggestConventionalType(prTitle)
    BotScript->>BotScript: formatMessage(title, suggestedType, prNumber)
    BotScript->>API: GET /repos/.../issues/prNumber/comments
    activate API
    API-->>BotScript: paginated comments list
    deactivate API
    alt Existing bot comment found
        BotScript->>API: PATCH /repos/.../comments/commentId
    else No existing comment
        BotScript->>API: POST /repos/.../issues/prNumber/comments
    end
    activate API
    API-->>BotScript: comment created/updated
    deactivate API
    BotScript-->>Workflow: success
    deactivate BotScript
    deactivate Workflow
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a conventional PR title bot for automated feedback on title validation failures.
Description check ✅ Passed The description is well-structured, clearly explaining the overview, changes, features, implementation details, and testing approach related to the bot implementation.
Linked Issues check ✅ Passed All requirements from issue #1705 are met: bot detects title check failures, displays current invalid title, suggests conventional types based on keywords, provides UI and CLI fix instructions, and includes Conventional Commits documentation link.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the bot implementation: bot script creation, workflow integration, and changelog entry. No unrelated modifications present.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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: 6

Comment on lines +102 to +119
function generateFixInstructions(suggestedType, escapedTitle, prNumber) {
return `### How to Fix This

#### Option 1: Via GitHub UI
1. Go to the top of this PR page
2. Click on the title to edit it
3. Add the type prefix (e.g., \`${suggestedType}:\`) before your current title
4. Save the changes

#### Option 2: Via Command Line
\`\`\`bash
# Note: Adjust the title as needed if it contains special characters
gh pr edit ${prNumber} --title "${suggestedType}: ${escapedTitle}"
\`\`\`

---
`;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Shell-escape on line 154 doesn't neutralize single quotes or newlines in the CLI example.

While the bash snippet is only displayed (not executed), a title containing newlines would produce a broken multi-line command in the code block. Consider also replacing \n and \r with spaces in the shell-escaped variant for a clean CLI example.

Comment on lines +1 to +4
# Workflow to check PR titles follow conventional commit format
# and provide automated guidance when titles are invalid

name: PR Formatting
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Workflow filename and script filename don't share a matching name.

The workflow is pr-check-title.yml but the script is bot-conventional-pr-title.js. Per coding guidelines, "Workflow filenames and their primary scripts SHOULD share a clear, matching name." Consider aligning them — e.g., renaming the script to pr-check-title.js or the workflow to bot-conventional-pr-title.yml.

As per coding guidelines, "Workflow filenames and their primary scripts SHOULD share a clear, matching name."

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is correct please

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 9, 2026

Caution

Review failed

Failed to post review comments

Walkthrough

Introduces a new GitHub Actions bot script that analyzes PR titles for conventional commit compliance, suggests improvements via keyword-based type detection, and automatically comments on PRs with helpful guidance. Updates the corresponding workflow to integrate the bot and provide user-friendly correction instructions.

Changes

Cohort / File(s) Summary
Bot Script Implementation
.github/scripts/bot-conventional-pr-title.js
New script (~300 lines) that analyzes PR titles, suggests conventional commit types via keyword matching, formats guidance messages with instructions and valid type list, and interacts with GitHub API to post or update PR comments with support for dry-run mode and robust error handling.
Workflow Integration
.github/workflows/pr-check-title.yml
Updated workflow to invoke the new bot script on title check failure, added workflow_dispatch dry_run input, renamed jobs and steps, updated concurrency configuration, and added repository checkout step for comment posting capabilities.
Changelog
CHANGELOG.md
Added entry documenting the new automated bot feature for providing PR title guidance.

Sequence Diagram

sequenceDiagram
    participant GitHub as GitHub
    participant Workflow as GitHub Actions Workflow
    participant BotScript as Bot Script
    participant API as GitHub API

    GitHub->>Workflow: PR event triggered
    activate Workflow
    Workflow->>BotScript: run(github, context, prNumber, prTitle, dryRun)
    activate BotScript
    BotScript->>BotScript: suggestConventionalType(prTitle)
    BotScript->>BotScript: formatMessage(title, suggestedType, prNumber)
    BotScript->>API: GET /repos/.../issues/prNumber/comments
    activate API
    API-->>BotScript: paginated comments list
    deactivate API
    alt Existing bot comment found
        BotScript->>API: PATCH /repos/.../comments/commentId
    else No existing comment
        BotScript->>API: POST /repos/.../issues/prNumber/comments
    end
    activate API
    API-->>BotScript: comment created/updated
    deactivate API
    BotScript-->>Workflow: success
    deactivate BotScript
    deactivate Workflow
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a conventional PR title bot for automated feedback on title validation failures.
Description check ✅ Passed The description is well-structured, clearly explaining the overview, changes, features, implementation details, and testing approach related to the bot implementation.
Linked Issues check ✅ Passed All requirements from issue #1705 are met: bot detects title check failures, displays current invalid title, suggests conventional types based on keywords, provides UI and CLI fix instructions, and includes Conventional Commits documentation link.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the bot implementation: bot script creation, workflow integration, and changelog entry. No unrelated modifications present.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

3 similar comments
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 9, 2026

Caution

Review failed

Failed to post review comments

Walkthrough

Introduces a new GitHub Actions bot script that analyzes PR titles for conventional commit compliance, suggests improvements via keyword-based type detection, and automatically comments on PRs with helpful guidance. Updates the corresponding workflow to integrate the bot and provide user-friendly correction instructions.

Changes

Cohort / File(s) Summary
Bot Script Implementation
.github/scripts/bot-conventional-pr-title.js
New script (~300 lines) that analyzes PR titles, suggests conventional commit types via keyword matching, formats guidance messages with instructions and valid type list, and interacts with GitHub API to post or update PR comments with support for dry-run mode and robust error handling.
Workflow Integration
.github/workflows/pr-check-title.yml
Updated workflow to invoke the new bot script on title check failure, added workflow_dispatch dry_run input, renamed jobs and steps, updated concurrency configuration, and added repository checkout step for comment posting capabilities.
Changelog
CHANGELOG.md
Added entry documenting the new automated bot feature for providing PR title guidance.

Sequence Diagram

sequenceDiagram
    participant GitHub as GitHub
    participant Workflow as GitHub Actions Workflow
    participant BotScript as Bot Script
    participant API as GitHub API

    GitHub->>Workflow: PR event triggered
    activate Workflow
    Workflow->>BotScript: run(github, context, prNumber, prTitle, dryRun)
    activate BotScript
    BotScript->>BotScript: suggestConventionalType(prTitle)
    BotScript->>BotScript: formatMessage(title, suggestedType, prNumber)
    BotScript->>API: GET /repos/.../issues/prNumber/comments
    activate API
    API-->>BotScript: paginated comments list
    deactivate API
    alt Existing bot comment found
        BotScript->>API: PATCH /repos/.../comments/commentId
    else No existing comment
        BotScript->>API: POST /repos/.../issues/prNumber/comments
    end
    activate API
    API-->>BotScript: comment created/updated
    deactivate API
    BotScript-->>Workflow: success
    deactivate BotScript
    deactivate Workflow
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a conventional PR title bot for automated feedback on title validation failures.
Description check ✅ Passed The description is well-structured, clearly explaining the overview, changes, features, implementation details, and testing approach related to the bot implementation.
Linked Issues check ✅ Passed All requirements from issue #1705 are met: bot detects title check failures, displays current invalid title, suggests conventional types based on keywords, provides UI and CLI fix instructions, and includes Conventional Commits documentation link.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the bot implementation: bot script creation, workflow integration, and changelog entry. No unrelated modifications present.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 9, 2026

Caution

Review failed

Failed to post review comments

Walkthrough

Introduces a new GitHub Actions bot script that analyzes PR titles for conventional commit compliance, suggests improvements via keyword-based type detection, and automatically comments on PRs with helpful guidance. Updates the corresponding workflow to integrate the bot and provide user-friendly correction instructions.

Changes

Cohort / File(s) Summary
Bot Script Implementation
.github/scripts/bot-conventional-pr-title.js
New script (~300 lines) that analyzes PR titles, suggests conventional commit types via keyword matching, formats guidance messages with instructions and valid type list, and interacts with GitHub API to post or update PR comments with support for dry-run mode and robust error handling.
Workflow Integration
.github/workflows/pr-check-title.yml
Updated workflow to invoke the new bot script on title check failure, added workflow_dispatch dry_run input, renamed jobs and steps, updated concurrency configuration, and added repository checkout step for comment posting capabilities.
Changelog
CHANGELOG.md
Added entry documenting the new automated bot feature for providing PR title guidance.

Sequence Diagram

sequenceDiagram
    participant GitHub as GitHub
    participant Workflow as GitHub Actions Workflow
    participant BotScript as Bot Script
    participant API as GitHub API

    GitHub->>Workflow: PR event triggered
    activate Workflow
    Workflow->>BotScript: run(github, context, prNumber, prTitle, dryRun)
    activate BotScript
    BotScript->>BotScript: suggestConventionalType(prTitle)
    BotScript->>BotScript: formatMessage(title, suggestedType, prNumber)
    BotScript->>API: GET /repos/.../issues/prNumber/comments
    activate API
    API-->>BotScript: paginated comments list
    deactivate API
    alt Existing bot comment found
        BotScript->>API: PATCH /repos/.../comments/commentId
    else No existing comment
        BotScript->>API: POST /repos/.../issues/prNumber/comments
    end
    activate API
    API-->>BotScript: comment created/updated
    deactivate API
    BotScript-->>Workflow: success
    deactivate BotScript
    deactivate Workflow
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a conventional PR title bot for automated feedback on title validation failures.
Description check ✅ Passed The description is well-structured, clearly explaining the overview, changes, features, implementation details, and testing approach related to the bot implementation.
Linked Issues check ✅ Passed All requirements from issue #1705 are met: bot detects title check failures, displays current invalid title, suggests conventional types based on keywords, provides UI and CLI fix instructions, and includes Conventional Commits documentation link.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the bot implementation: bot script creation, workflow integration, and changelog entry. No unrelated modifications present.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 9, 2026

Caution

Review failed

Failed to post review comments

Walkthrough

Introduces a new GitHub Actions bot script that analyzes PR titles for conventional commit compliance, suggests improvements via keyword-based type detection, and automatically comments on PRs with helpful guidance. Updates the corresponding workflow to integrate the bot and provide user-friendly correction instructions.

Changes

Cohort / File(s) Summary
Bot Script Implementation
.github/scripts/bot-conventional-pr-title.js
New script (~300 lines) that analyzes PR titles, suggests conventional commit types via keyword matching, formats guidance messages with instructions and valid type list, and interacts with GitHub API to post or update PR comments with support for dry-run mode and robust error handling.
Workflow Integration
.github/workflows/pr-check-title.yml
Updated workflow to invoke the new bot script on title check failure, added workflow_dispatch dry_run input, renamed jobs and steps, updated concurrency configuration, and added repository checkout step for comment posting capabilities.
Changelog
CHANGELOG.md
Added entry documenting the new automated bot feature for providing PR title guidance.

Sequence Diagram

sequenceDiagram
    participant GitHub as GitHub
    participant Workflow as GitHub Actions Workflow
    participant BotScript as Bot Script
    participant API as GitHub API

    GitHub->>Workflow: PR event triggered
    activate Workflow
    Workflow->>BotScript: run(github, context, prNumber, prTitle, dryRun)
    activate BotScript
    BotScript->>BotScript: suggestConventionalType(prTitle)
    BotScript->>BotScript: formatMessage(title, suggestedType, prNumber)
    BotScript->>API: GET /repos/.../issues/prNumber/comments
    activate API
    API-->>BotScript: paginated comments list
    deactivate API
    alt Existing bot comment found
        BotScript->>API: PATCH /repos/.../comments/commentId
    else No existing comment
        BotScript->>API: POST /repos/.../issues/prNumber/comments
    end
    activate API
    API-->>BotScript: comment created/updated
    deactivate API
    BotScript-->>Workflow: success
    deactivate BotScript
    deactivate Workflow
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a conventional PR title bot for automated feedback on title validation failures.
Description check ✅ Passed The description is well-structured, clearly explaining the overview, changes, features, implementation details, and testing approach related to the bot implementation.
Linked Issues check ✅ Passed All requirements from issue #1705 are met: bot detects title check failures, displays current invalid title, suggests conventional types based on keywords, provides UI and CLI fix instructions, and includes Conventional Commits documentation link.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the bot implementation: bot script creation, workflow integration, and changelog entry. No unrelated modifications present.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

Signed-off-by: Ashhar Ahmad Khan <145142826+AshharAhmadKhan@users.noreply.github.com>
- Fix missing closing brace in formatMessage function
- Add COMMENT_IDENTIFIER constant definition
- Add feat keyword detection for feature-related titles
- Implement markdown injection prevention via escapeForMarkdown
- Fix parameter naming (safeTitle vs currentTitle)
- Reduce formatMessage complexity to 12 lines

Signed-off-by: Ashhar Ahmad Khan <145142826+AshharAhmadKhan@users.noreply.github.com>
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

Comment on lines +147 to +152
function escapeForMarkdown(text) {
return text
.replace(/```/g, 'ʼʼʼ')
.replace(/\r?\n|\r/g, ' ')
.trim();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Unicode lookalike replacement (ʼʼʼ U+02BC) can silently corrupt copy-pasted text.

The suggested title on line 86 (${suggestedType}: ${safeTitle}) uses safeTitle, so anyone who copies the suggestion from the code block gets modifier-letter apostrophes instead of backticks. Replacing with ASCII single quotes (''') or simply stripping backticks is more transparent and avoids invisible corruption.

Proposed fix
 function escapeForMarkdown(text) {
   return text
-    .replace(/```/g, 'ʼʼʼ')
+    .replace(/`/g, "'")
     .replace(/\r?\n|\r/g, ' ')
     .trim();
 }

- Replace multiple if-statements with loop-based pattern matching
- Reduces complexity from 15 to 4 (well below Codacy limit of 12)
- Maintains all functionality and keyword detection
- Addresses Codacy static analysis concerns

Signed-off-by: Ashhar Ahmad Khan <145142826+AshharAhmadKhan@users.noreply.github.com>
@github-actions
Copy link

Hi, this is MergeConflictBot.
Your pull request cannot be merged because it contains merge conflicts.

Please resolve these conflicts locally and push the changes.

Quick Fix for CHANGELOG.md Conflicts

If your conflict is only in CHANGELOG.md, you can resolve it easily using the GitHub web editor:

  1. Click on the "Resolve conflicts" button in the PR
  2. Accept both changes (keep both changelog entries)
  3. Click "Mark as resolved"
  4. Commit the merge

For all other merge conflicts, please read:

Thank you for contributing!

Copy link
Contributor

@exploreriii exploreriii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @AshharAhmadKhan
Thank you for spending the time into making this and I like all the details you have added

Unfortunately, this is is a major refactor, you have even changed the underlying package we use for the title check

There are a few errors I see already with the packages you are using, so this will benefit from more research into what each package does and what is the latest release and what it entails

In this case, we have to require major testing
please do merge this to your fork, once corrections are made
Fork the repo
Create a branch in the fork
Open a PR
Trigger your invalid title
Watch what the job does

test various edge case scenarios, like a correct title

Then please link your test results
Thank you

Comment on lines +1 to +4
# Workflow to check PR titles follow conventional commit format
# and provide automated guidance when titles are invalid

name: PR Formatting
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is correct please

- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you suggesting 2.10.2?
https://github.com/step-security/harden-runner
Please check latest releases -- extract the commit hash
docs/sdk_developers/how-to-pin-github-actions.md

- name: Check PR Title
uses: step-security/conventional-pr-title-action@cb1c5657ccf4c42f5c0a6c0708cb8251b960d902 # v3.2.5
- name: Check PR title format
uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 # v5.5.3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you are suggesting a change from one action package to another, we expect thorough testing please


- name: Checkout repository
if: failure()
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are consistently using outdated packages

# Workflow to check PR titles follow conventional commit format
# and provide automated guidance when titles are invalid

name: PR Formatting
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you want to do dry run, it is probably better to pass it in the yml rather than construct it in the logic script

@exploreriii exploreriii marked this pull request as draft February 10, 2026 12:18
@exploreriii exploreriii added the status: needs developer revision PR has requested changes that the developer needs to implement label Feb 10, 2026
Copy link
Contributor

@MonaaEid MonaaEid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please provide a test link for the implementation in your fork? Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: needs developer revision PR has requested changes that the developer needs to implement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Intermediate]: Create conventional-pr-title bot message

3 participants