Problem
The welcome message displays features that may not be configured for the repository:
1. Container Operations Section - Always Shown
- Location:
webhook_server/libs/handlers/pull_request_handler.py:281-283
- Current behavior: The "Container Operations" section with
/build-and-push-container is unconditionally displayed
- Expected behavior: Only show when
container is configured for the repository
2. Pre-commit Checks Line - Always Shown
- Location:
webhook_server/libs/handlers/pull_request_handler.py:255
- Current behavior: The "Pre-commit Checks" line is unconditionally displayed in automatic actions
- Expected behavior: Only show when
pre-commit is enabled in config
Current Code (Problematic)
# Line 255 - always shown
* **Pre-commit Checks**: [pre-commit](https://pre-commit.ci/) runs automatically if `.pre-commit-config.yaml` exists
# Lines 281-283 - always shown
#### Container Operations
* `/build-and-push-container` - Build and push container image (tagged with PR number)
* Supports additional build arguments: `/build-and-push-container --build-arg KEY=value`
Reference: Correct Pattern
The _prepare_retest_welcome_comment property (lines 345-367) correctly implements conditional logic:
if self.github_webhook.build_and_push_container:
retest_msg += f" * `/retest {BUILD_CONTAINER_STR}` - Rebuild and test container image\n"
if self.github_webhook.pre_commit:
retest_msg += f" * `/retest {PRE_COMMIT_STR}` - Run pre-commit hooks and checks\n"
Suggested Fix
Apply the same conditional pattern to:
- Wrap Container Operations section with
if self.github_webhook.build_and_push_container:
- Wrap Pre-commit Checks line with
if self.github_webhook.pre_commit:
Impact
Users of repositories without container/pre-commit configuration see commands that don't work for their repository, causing confusion.
Problem
The welcome message displays features that may not be configured for the repository:
1. Container Operations Section - Always Shown
webhook_server/libs/handlers/pull_request_handler.py:281-283/build-and-push-containeris unconditionally displayedcontaineris configured for the repository2. Pre-commit Checks Line - Always Shown
webhook_server/libs/handlers/pull_request_handler.py:255pre-commitis enabled in configCurrent Code (Problematic)
Reference: Correct Pattern
The
_prepare_retest_welcome_commentproperty (lines 345-367) correctly implements conditional logic:Suggested Fix
Apply the same conditional pattern to:
if self.github_webhook.build_and_push_container:if self.github_webhook.pre_commit:Impact
Users of repositories without container/pre-commit configuration see commands that don't work for their repository, causing confusion.