-
Couldn't load subscription status.
- Fork 1.1k
Bitbucket: Add push_commands support when PR is updated #2085
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||||||||||||
| if commands_conf == "push_commands": | ||
| if not get_settings().get("bitbucket_app.handle_push_trigger"): | ||
| get_logger().info( | ||
| "Bitbucket push trigger handling disabled via 'bitbucket_app.handle_push_trigger'; skipping push commands") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/implement
Remove bitbucket_app.handle_push_trigger' from the comment to make it easier to maintain in the future. Draft 3 alternatives.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Implementation 🛠️
Implementation: Update the log message to remove the hardcoded 'bitbucket_app.handle_push_trigger' configuration key reference. Provide three concise alternative messages that are easier to maintain.
| "Bitbucket push trigger handling disabled via 'bitbucket_app.handle_push_trigger'; skipping push commands") | |
| # Alternative 1: | |
| "Bitbucket push trigger handling disabled; skipping push commands") | |
| # Alternative 2: | |
| "Push trigger handling is disabled; skipping push commands") | |
| # Alternative 3: | |
| "Push-trigger handling disabled; skipping push commands") |
See review comment here
PR Type
Enhancement
Description
Add support for
push_commandswhen Bitbucket PR is updatedImplement validation to ensure push commands only trigger from actual commits
Validate time delta between last commit and PR update (max 15 seconds)
Verify commit author matches PR updater to prevent false triggers
Diagram Walkthrough
File Walkthrough
bitbucket_app.py
Add push_commands validation and pullrequest:updated handlerpr_agent/servers/bitbucket_app.py
_validate_time_from_last_commit_to_pr_update()function tovalidate push events by checking time delta and author match
pullrequest:updatedevent to triggerpush_commandswith validation
bitbucket_app.handle_push_triggersetting
new
PRAgent()instance