Skip to content

feat(ci): add unique PR identity - #205

Merged
utkarsh232005 merged 2 commits into
KDM-cli:mainfrom
Akanshagore:feat/unique-pr-identifier
Aug 12, 2026
Merged

feat(ci): add unique PR identity#205
utkarsh232005 merged 2 commits into
KDM-cli:mainfrom
Akanshagore:feat/unique-pr-identifier

Conversation

@Akanshagore

Copy link
Copy Markdown
Contributor

Summary

  • Add unique PR identity generation
  • Standardize PR titles as [KDM-MODULE-TYPE-ID]
  • Update PR titles automatically using the existing labeler workflow
  • Reuse the shared updatePullRequest API helper

Changes

  • Added updatePullRequest() to .github/scripts/helpers/api.cjs
  • Added unique PR title generation to .github/scripts/pr-labeler.cjs
  • PR module is detected from changed file paths
  • PR type is detected from the title
  • PR number is used as the unique identifier

Validation

  • node --check .github/scripts/helpers/api.cjs
  • node --check .github/scripts/pr-labeler.cjs
  • git diff --check
  • npm test
  • 26 test files passed
  • 340 tests passed

Closes #107

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

.coderabbit.yaml has a parsing error

The CodeRabbit configuration file in this repository has a parsing error and default settings were used instead. Please fix the error(s) in the configuration file. You can initialize chat with CodeRabbit to get help with the configuration file.

💥 Parsing errors (2)
Validation error: Invalid input: expected string, received undefined at "reviews.path_instructions[3].path"; Invalid input: expected string, received undefined at "reviews.path_instructions[3].instructions"
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: QUIET

Plan: Pro Plus

Run ID: ed9607ae-368a-466a-90ca-0bf2097835ae

📥 Commits

Reviewing files that changed from the base of the PR and between d4b63bc and fae5e3d.

📒 Files selected for processing (1)
  • .github/scripts/pr-labeler.cjs

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Pull requests are now automatically given standardized titles based on their detected module, change type, and number.
    • Existing KDM title prefixes are replaced to keep titles consistent.
    • Title formatting is validated before updates are applied.
  • Bug Fixes

    • Title-update failures are handled without interrupting pull request labeling.
    • Pull requests with unrecognized or incomplete title information continue through labeling safely.

Walkthrough

The PR labeler detects module-qualified KDM titles, builds standardized identity titles, and updates pull request titles through a shared GitHub API helper. Update failures are logged without stopping label processing.

Changes

PR identity title updates

Layer / File(s) Summary
Pull request title update API
.github/scripts/helpers/api.cjs
Adds and exports updatePullRequest, with title validation, GitHub REST API updates, success logging, and structured error handling.
Labeler identity title flow
.github/scripts/pr-labeler.cjs
Detects module-qualified KDM titles, builds titles from the matched module, type, and pull request number, and continues labeling when updates fail.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Labeler as pr-labeler
  participant Builder as buildPRIdentityTitle
  participant Helper as updatePullRequest
  participant GitHub as GitHub REST API

  Labeler->>Builder: Matched module, type, PR number, current title
  Builder-->>Labeler: Standardized identity title or null
  Labeler->>Helper: Update title when it differs
  Helper->>GitHub: Update pull request title
  GitHub-->>Helper: Success or structured error
  Helper-->>Labeler: Update result
  Labeler->>Labeler: Log failure and continue labeling
Loading

Possibly related PRs

  • KDM-cli/kdm-cli#148: The PR labeler and shared API helper changes extend code introduced or modified by this PR.

Suggested reviewers: utkarsh232005

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding unique pull request identity generation.
Description check ✅ Passed The description directly describes standardized PR titles, identity generation, API updates, and validation results.
Linked Issues check ✅ Passed The changes implement the unique PR identity and standardized title requirements described in issue #107.
Out of Scope Changes check ✅ Passed The changed files and functionality directly support the unique PR identity and title-standardization objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
📋 Issue Planner

Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).

View plan for ticket: #107


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.

codescene-delta-analysis[bot]

This comment was marked as outdated.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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/scripts/pr-labeler.cjs:
- Around line 98-100: Update detectType() and the cleanedTitle expression to
share parsing for the emitted [KDM-CONFIG-FIX-123] format, while retaining
support for and removing the legacy [KDM-123-FIX] prefix during migration.
Ensure typeKey extraction and subsequent title processing work on either
supported format.
🪄 Autofix

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: Repository UI

Review profile: QUIET

Plan: Pro Plus

Run ID: dc5d2158-32fd-4274-a9a2-5c4377d0b17b

📥 Commits

Reviewing files that changed from the base of the PR and between f3b6bde and d4b63bc.

📒 Files selected for processing (2)
  • .github/scripts/helpers/api.cjs
  • .github/scripts/pr-labeler.cjs

Comment thread .github/scripts/pr-labeler.cjs Outdated

@codescene-delta-analysis codescene-delta-analysis Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No application code in the PR — skipped Code Health checks.

See analysis details in CodeScene

Quality Gate Profile: The Bare Minimum
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.

@Akanshagore

Copy link
Copy Markdown
Contributor Author

Hi @utkarsh232005, I’ve addressed the CodeRabbit review comment and pushed the fix in the latest commit. CodeRabbit has now approved the changes with no actionable comments. Could you please review the PR when you get a chance? Thanks!

@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@utkarsh232005

Copy link
Copy Markdown
Member

Hi @utkarsh232005, I’ve addressed the CodeRabbit review comment and pushed the fix in the latest commit. CodeRabbit has now approved the changes with no actionable comments. Could you please review the PR when you get a chance? Thanks!

The code is clean, and the tests passed successfully. Great work! I'll go ahead and merge this as is.

@utkarsh232005

Copy link
Copy Markdown
Member

@Akanshagore Thank you for the contribution! We look forward to seeing more from you in the future. Please feel free to check out the other open issues in the repository as well.

@utkarsh232005
utkarsh232005 merged commit 26a3fff into KDM-cli:main Aug 12, 2026
10 of 13 checks passed
@utkarsh232005

Copy link
Copy Markdown
Member

@all-contributors please add @Akanshagore for code

@allcontributors

Copy link
Copy Markdown

@utkarsh232005

I've put up a pull request to add @Akanshagore! 🎉

@Akanshagore

Copy link
Copy Markdown
Contributor Author

Thank you so much for the review and for merging the PR! 🙌 Really appreciate the feedback and guidance. Looking forward to contributing more to KDM-cli! 🚀

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Introduce a Unique PR Identity & Smart Labeling System

2 participants