repo edit: add squash merge commit title/message flags#12874
repo edit: add squash merge commit title/message flags#12874SergioChan wants to merge 1 commit intocli:trunkfrom
Conversation
There was a problem hiding this comment.
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
SquashMergeCommitMessageandSquashMergeCommitTitlefields to the repo edit PATCH payload struct. - Register
--squash-merge-commit-messageand--squash-merge-commit-titleflags 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.
| 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"), | ||
| }, |
There was a problem hiding this comment.
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.
|
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. |
Summary
--squash-merge-commit-messageand--squash-merge-commit-titleflags togh repo editEditRepositoryInputso they map directly to the repository update API payloadTestNewCmdEditTesting
go test ./pkg/cmd/repo/edit -run TestNewCmdEdit -count=1go test ./pkg/cmd/repo/edit -run Test_editRun -count=1Related
Fixes #10092