Skip to content

repo edit: add squash merge commit title/message flags#12874

Closed
SergioChan wants to merge 1 commit intocli:trunkfrom
SergioChan:fix-repo-edit-squash-commit-fields-10092
Closed

repo edit: add squash merge commit title/message flags#12874
SergioChan wants to merge 1 commit intocli:trunkfrom
SergioChan:fix-repo-edit-squash-commit-fields-10092

Conversation

@SergioChan
Copy link

@SergioChan SergioChan commented Mar 8, 2026

Summary

  • add --squash-merge-commit-message and --squash-merge-commit-title flags to gh repo edit
  • wire both flags into EditRepositoryInput so they map directly to the repository update API payload
  • add command parsing coverage for both new flags in TestNewCmdEdit

Testing

  • go test ./pkg/cmd/repo/edit -run TestNewCmdEdit -count=1
  • go test ./pkg/cmd/repo/edit -run Test_editRun -count=1

Related

Fixes #10092

@github-actions github-actions bot added external pull request originating outside of the CLI core team needs-triage needs to be reviewed labels Mar 8, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support in gh repo edit for configuring the repository’s squash-merge commit title/message defaults via new CLI flags, mapping them through to the REST repos.update payload.

Changes:

  • Add SquashMergeCommitMessage and SquashMergeCommitTitle fields to the repo edit PATCH payload struct.
  • Register --squash-merge-commit-message and --squash-merge-commit-title flags to populate those fields.
  • Add command parsing test coverage for the new flags.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
pkg/cmd/repo/edit/edit.go Adds new PATCH payload fields and wires up two new flags to set them.
pkg/cmd/repo/edit/edit_test.go Adds a TestNewCmdEdit case covering parsing for the new flags.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +38 to +45
name: "set squash merge commit defaults",
args: "--squash-merge-commit-message PR_BODY --squash-merge-commit-title PR_TITLE",
wantOpts: EditOptions{
Repository: ghrepo.NewWithHost("OWNER", "REPO", "github.com"),
Edits: EditRepositoryInput{
SquashMergeCommitMessage: sp("PR_BODY"),
SquashMergeCommitTitle: sp("PR_TITLE"),
},
Copy link

Copilot AI Mar 8, 2026

Choose a reason for hiding this comment

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

This test only verifies flag parsing. There’s no Test_editRun coverage that the new options are actually serialized into the PATCH payload under the expected REST field names (squash_merge_commit_message / squash_merge_commit_title). Add an editRun test case that stubs the PATCH request and asserts those payload keys/values are present when these options are set.

Copilot uses AI. Check for mistakes.
@babakks
Copy link
Member

babakks commented Mar 9, 2026

I'm closing this as there's already another one opened for the same issue (See #12846).

We may reopen this if we ever decided to close the other PR.

@babakks babakks closed this Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external pull request originating outside of the CLI core team needs-triage needs to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow setting squash merge commit message and title in gh repo edit

3 participants