Skip to content
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

Add Draft Pull request option #297

Merged
merged 1 commit into from
Apr 1, 2025
Merged

Add Draft Pull request option #297

merged 1 commit into from
Apr 1, 2025

Conversation

edify42
Copy link
Contributor

@edify42 edify42 commented Apr 1, 2025

New feature in bitbucket allows for draft: true to be supplied when creating the PR to mark it as a DRAFT Pull request.
image

Signed-off-by: Edward Kim <[email protected]>
Copy link

@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.

Hello @edify42, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

This pull request introduces the ability to mark a pull request as a draft in Bitbucket by adding a draft: true option when creating the PR. I've added a Draft field to the PullRequestsOptions struct in bitbucket.go and modified pullrequests.go to include the draft status in the request body when creating a pull request.

Highlights

  • New Feature: Draft Pull Requests: Adds support for creating draft pull requests in Bitbucket.
  • Modified Struct: PullRequestsOptions: The PullRequestsOptions struct in bitbucket.go now includes a Draft field.
  • Request Body Update: The buildPullRequestBody function in pullrequests.go now includes the draft status in the request body.

Changelog

  • bitbucket.go
    • Added Draft field to the PullRequestsOptions struct (line 317).
    • Corrected the formatting of the SSHKeyOptions struct (lines 669, 670, 671, 672).
  • pullrequests.go
    • Modified buildPullRequestBody to include the draft status in the request body (lines 249-251).
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


A draft PR's gentle start,
A safe space to build and chart,
Before the review,
A chance to renew,
And perfect the work of the heart.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@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 the functionality to mark a pull request as a draft in Bitbucket. The changes look good overall, but there are a few areas that could be improved for clarity and efficiency.

Summary of Findings

  • Redundant boolean condition: The condition po.CloseSourceBranch == true || po.CloseSourceBranch == false can be simplified to true or po.CloseSourceBranch || !po.CloseSourceBranch can be simplified to true.
  • Inconsistent struct field alignment: The fields in SSHKeyOptions struct are not consistently aligned. While this doesn't affect functionality, aligning them improves readability.

Merge Readiness

The pull request is almost ready for merging. Addressing the redundant boolean condition and aligning the struct fields will improve the code's clarity and maintainability. I am unable to directly approve this pull request, and recommend that others review and approve this code before merging.

Comment on lines +245 to 246
if po.CloseSourceBranch || !po.CloseSourceBranch {
body["close_source_branch"] = po.CloseSourceBranch

Choose a reason for hiding this comment

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

medium

This condition is always true and can be simplified to true. Consider removing the condition altogether and directly assigning body["close_source_branch"] = po.CloseSourceBranch.

Alternatively, you can simplify the condition to po.CloseSourceBranch || !po.CloseSourceBranch which is also always true, but less readable than just true.

body["close_source_branch"] = po.CloseSourceBranch

@edify42
Copy link
Contributor Author

edify42 commented Apr 1, 2025

hey @ktrysmt if you're still maintaining this 🙏

Copy link
Owner

@ktrysmt ktrysmt left a comment

Choose a reason for hiding this comment

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

LGTM

@ktrysmt ktrysmt merged commit 49e9ab1 into ktrysmt:master Apr 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants