Skip to content

fix(lock-bot): dynamically adjust lock message for issues vs pull requests#3693

Merged
alan-agius4 merged 2 commits into
angular:mainfrom
BHUVANSH855:fix-lockbot-pr-message
May 21, 2026
Merged

fix(lock-bot): dynamically adjust lock message for issues vs pull requests#3693
alan-agius4 merged 2 commits into
angular:mainfrom
BHUVANSH855:fix-lockbot-pr-message

Conversation

@BHUVANSH855
Copy link
Copy Markdown
Contributor

@BHUVANSH855 BHUVANSH855 commented May 21, 2026

Summary

This change improves the automatic lock message generated by the Angular lock bot.

Previously, the bot always displayed:
"This issue has been automatically locked due to inactivity."
even when closing a pull request.

With this update:

  • The bot now dynamically detects whether the item is an issue or a pull request.
  • Issues retain the original wording.
  • Pull requests now correctly display: "This pull request has been automatically locked due to inactivity."
  • All other bot behavior remains unchanged.

Motivation

This is a minor UX and consistency improvement to make bot messages clearer for contributors.

Screenshots / Example

See the comment made by the bot under my merged PR
[https://github.com/angular/angular/pull/68297]

image

Notes

  • No security implications.
  • Fully compliant with Angular's Code of Conduct and Security Policy.

Closes angular/angular#68848

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a dynamic message generator for locking closed issues and pull requests, replacing the previous static message implementation. Feedback focuses on refactoring the getLockMessage function to improve type safety by replacing the any type with a specific union type, fixing a wording regression where the 'This ' prefix was omitted, and simplifying the logic by passing the pre-calculated item type directly to the helper function.

Comment thread .github/local-actions/lock-closed/lib/main.ts Outdated
Comment thread .github/local-actions/lock-closed/lib/main.ts Outdated
@BHUVANSH855 BHUVANSH855 force-pushed the fix-lockbot-pr-message branch from c4edbe0 to b1fe9b2 Compare May 21, 2026 09:11
@alan-agius4 alan-agius4 force-pushed the fix-lockbot-pr-message branch from b1fe9b2 to bb152b0 Compare May 21, 2026 09:36
Copy link
Copy Markdown
Contributor

@alan-agius4 alan-agius4 left a comment

Choose a reason for hiding this comment

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

Thanks LGTM

@alan-agius4 alan-agius4 force-pushed the fix-lockbot-pr-message branch from bb152b0 to a5cd089 Compare May 21, 2026 09:37
@alan-agius4 alan-agius4 added the action: merge The PR is ready for merge by the caretaker label May 21, 2026
@alan-agius4 alan-agius4 force-pushed the fix-lockbot-pr-message branch from a5cd089 to 45cf9c4 Compare May 21, 2026 09:40
@alan-agius4 alan-agius4 merged commit d9e91f2 into angular:main May 21, 2026
12 checks passed
@alan-agius4
Copy link
Copy Markdown
Contributor

This PR was merged into the repository. The changes were merged into the following branches:

erkamyaman added a commit to erkamyaman/dev-infra that referenced this pull request May 21, 2026
angular#3693 refactored the lock-closed action to vary its message
between "issue" and "pull request" based on the conversation
type. In the rewrite the leading "This" was dropped, so the bot
now opens with "Issue has been automatically locked..." or
"Pull request has been automatically locked..." instead of the
previous "This issue has been...".

The wording requested in the originating issue
(angular/angular#68848) was likewise "This pull request has been
automatically locked due to inactivity." for the PR variant, so
the current output matches neither the pre-angular#3693 message nor the
phrasing the proposal asked for.

Restore the "This " prefix and use itemType as-is (already
lowercase in the union) instead of upper-casing the first
character. Both branches of the template now read naturally:

- "This issue has been automatically locked due to inactivity."
- "This pull request has been automatically locked due to inactivity."
erkamyaman added a commit to erkamyaman/dev-infra that referenced this pull request May 21, 2026
angular#3693 dropped the leading "This " from the lock-bot message, so it now opens with "Issue has been..." or "Pull request has been..." instead of "This issue has been...". This also no longer matches the wording asked for in angular/angular#68848. Restore the "This " prefix so both branches read naturally and match the original request.

Refs angular#3693, angular/angular#68848
erkamyaman added a commit to erkamyaman/dev-infra that referenced this pull request May 21, 2026
angular#3693 dropped the leading "This " from the lock-bot message, so it now opens with "Issue has been..." or "Pull request has been..." instead of "This issue has been...". This also no longer matches the wording asked for in angular/angular#68848. Restore the "This " prefix so both branches read naturally and match the original request.

Refs angular#3693, angular/angular#68848
erkamyaman added a commit to erkamyaman/dev-infra that referenced this pull request May 21, 2026
angular#3693 dropped the leading "This " from the lock-bot message, so it now opens with "Issue has been..." or "Pull request has been..." instead of "This issue has been...". This also no longer matches the wording asked for in angular/angular#68848. Restore the "This " prefix so both branches read naturally and match the original request.

Refs angular#3693, angular/angular#68848
alan-agius4 pushed a commit that referenced this pull request May 21, 2026
#3693 dropped the leading "This " from the lock-bot message, so it now opens with "Issue has been..." or "Pull request has been..." instead of "This issue has been...". This also no longer matches the wording asked for in angular/angular#68848. Restore the "This " prefix so both branches read naturally and match the original request.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Automatic lock bot message says “issue” on Pull Requests

2 participants