github-api icon indicating copy to clipboard operation
github-api copied to clipboard

allowSquashMerge : "Default commit message" parameters are missing

Open sbouchexbellomie-Philips opened this issue 1 year ago • 3 comments

allowSquashMerge is only accepting an "enabled" parameter whereas the GitHub API is gving the ability to set the "Default commit message" (default message, PR title, PR title + commit details, PR title + description)

Any plan to add it ? Need a PR ?

PRs welcome!

bitwiseman avatar Oct 22 '24 07:10 bitwiseman

I have been working on issue [#1964]regarding the allowSquashMerge method in the GHRepositoryBuilder.java file. The issue indicates that a PR is welcome to add the ability to set the default commit message for squash merges.

I propose modifying the allowSquashMerge method to accept an additional parameter for the default commit message. This change will allow users to specify a default commit message when enabling squash merges. I plan to update the corresponding usages and tests to reflect this change.

Please let me know if you have any feedback or suggestions.

Thank you!

shivangi-jindal avatar Dec 28 '24 07:12 shivangi-jindal

The create and update endpoints for repositories take a number of parameters: https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#update-a-repository

allow_squash_merge is still a boolean, so you should not change the allowSquashMerge() method.

There are other parameters that control commit messages and titles.

  • squash_merge_commit_title  - Can be one of: PR_TITLE, COMMIT_OR_PR_TITLE
  • squash_merge_commit_message - Can be one of: PR_BODY, COMMIT_MESSAGES, BLANK
  • merge_commit_title - Can be one of: PR_TITLE, MERGE_MESSAGE
  • merge_commit_message - Can be one of: PR_BODY, PR_TITLE, BLANK

To implement this feature, add new methods GHRepositoryBuilder for these other endpoint parameters. NOTE: the above are technically string values but should be implemented as enum parameters here.

bitwiseman avatar Jan 02 '25 22:01 bitwiseman