Skip to content

Commit 150feee

Browse files
authored
Merge pull request #5479 from camilamacedo86/rename-before-release
✨ refactor(alpha/update): shorten commit message flag names
2 parents 8f9fc94 + ecf3898 commit 150feee

File tree

4 files changed

+54
-14
lines changed

4 files changed

+54
-14
lines changed

docs/book/src/plugins/available/autoupdate-v1-alpha.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,44 @@ The plugin scaffolds a GitHub Actions workflow that checks for new Kubebuilder r
8585

8686
<img width="600" height="188" alt="Conflicts" src="https://github.com/user-attachments/assets/2142887a-730c-499a-94df-c717f09ab600" />
8787

88+
## Customizing the Workflow
89+
90+
The generated workflow uses the `kubebuilder alpha update` command with default flags. You can customize the workflow by editing `.github/workflows/auto_update.yml` to add additional flags:
91+
92+
**Default flags used:**
93+
- `--force` - Continue even if conflicts occur (automation-friendly)
94+
- `--push` - Automatically push the output branch to remote
95+
- `--restore-path .github/workflows` - Preserve CI workflows from base branch
96+
- `--open-gh-issue` - Create a GitHub Issue with PR compare link
97+
- `--use-gh-models` - (optional) Add AI summary to the issue
98+
99+
**Additional available flags:**
100+
- `--merge-message` - Custom commit message for clean merges
101+
- `--conflict-message` - Custom commit message when conflicts occur
102+
- `--from-version` - Specify the version to upgrade from
103+
- `--to-version` - Specify the version to upgrade to
104+
- `--output-branch` - Custom output branch name
105+
- `--show-commits` - Keep full history instead of squashing
106+
- `--git-config` - Pass per-invocation Git config
107+
108+
For complete documentation on all available flags, see the [`kubebuilder alpha update`][alpha-update-command] reference.
109+
110+
**Example: Customize commit messages**
111+
112+
Edit `.github/workflows/auto_update.yml`:
113+
114+
```yaml
115+
- name: Run kubebuilder alpha update
116+
run: |
117+
kubebuilder alpha update \
118+
--force \
119+
--push \
120+
--restore-path .github/workflows \
121+
--open-gh-issue \
122+
--merge-message "chore: update kubebuilder scaffold" \
123+
--conflict-message "chore: update with conflicts - review needed"
124+
```
125+
88126
## Troubleshooting
89127
90128
#### If you get the 403 Forbidden Error

docs/book/src/reference/commands/alpha_update.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ The command creates three temporary branches:
6464
- `--show-commits`: keep the full history.
6565
- `--restore-path`: in squash mode, restore specific files (like CI configs) from your base branch.
6666
- `--output-branch`: pick a custom branch name.
67-
- `--commit-message`: customize the commit message for clean merges.
68-
- `--commit-message-conflict`: customize the commit message when conflicts occur.
67+
- `--merge-message`: customize the commit message for clean merges.
68+
- `--conflict-message`: customize the commit message when conflicts occur.
6969
- `--push`: push the result to `origin` automatically.
7070
- `--git-config`: sets git configurations.
7171
- `--open-gh-issue`: create a GitHub issue with a checklist and compare link (requires `gh`).
@@ -127,8 +127,8 @@ Customize commit messages:
127127

128128
```shell
129129
kubebuilder alpha update --force \
130-
--commit-message "chore: upgrade kubebuilder scaffold" \
131-
--commit-message-conflict "chore: upgrade with conflicts - manual review needed"
130+
--merge-message "chore: upgrade kubebuilder scaffold" \
131+
--conflict-message "chore: upgrade with conflicts - manual review needed"
132132
```
133133

134134
## Handling Conflicts (`--force` vs default)
@@ -235,12 +235,12 @@ We use that value to pick the correct CLI for re-scaffolding.
235235

236236
| Flag | Description |
237237
|------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
238-
| `--commit-message` | Custom commit message for successful merges (no conflicts). Defaults to `chore(kubebuilder): update scaffold <from> -> <to>`. |
239-
| `--commit-message-conflict` | Custom commit message for merges with conflicts. Defaults to `:warning: chore(kubebuilder): update scaffold (manual conflict resolution) <from> -> <to>`. |
238+
| `--conflict-message` | Custom commit message for merges with conflicts. Defaults to `:warning: chore(kubebuilder): update scaffold (manual conflict resolution) <from> -> <to>`. |
240239
| `--force` | Continue even if merge conflicts happen. Conflicted files are committed with conflict markers (CI/cron friendly). |
241240
| `--from-branch` | Git branch that holds your current project code. Defaults to `main`. |
242241
| `--from-version` | Kubebuilder release to update **from** (e.g., `v4.6.0`). If unset, read from the `PROJECT` file when possible. |
243242
| `--git-config` | Repeatable. Pass per-invocation Git config as `-c key=value`. **Default** (if omitted): `-c merge.renameLimit=999999 -c diff.renameLimit=999999`. Your configs are applied on top. To disable defaults, include `--git-config disable`. |
243+
| `--merge-message` | Custom commit message for successful merges (no conflicts). Defaults to `chore(kubebuilder): update scaffold <from> -> <to>`. |
244244
| `--open-gh-issue` | Create a GitHub issue with a pre-filled checklist and compare link after the update completes (requires `gh`). |
245245
| `--output-branch` | Name of the output branch. Default: `kubebuilder-update-from-<from-version>-to-<to-version>`. |
246246
| `--push` | Push the output branch to the `origin` remote after the update completes. |

pkg/cli/alpha/internal/update/update.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,13 @@ type Update struct {
7575
// Push, when true, pushes the OutputBranch to the "origin" remote after the update completes.
7676
Push bool
7777

78-
// CommitMessage is the custom commit message to use for successful merges (no conflicts).
78+
// CommitMessage is the custom merge message to use for successful merges (no conflicts).
79+
// Set via --merge-message flag.
7980
// If empty, defaults to: "chore(kubebuilder): update scaffold <from> -> <to>".
8081
CommitMessage string
8182

82-
// CommitMessageConflict is the custom commit message to use when conflicts occur.
83+
// CommitMessageConflict is the custom conflict message to use when conflicts occur.
84+
// Set via --conflict-message flag.
8385
// If empty, defaults to: "chore(kubebuilder): (:warning: manual conflict resolution required)
8486
// update scaffold <from> -> <to>".
8587
CommitMessageConflict string

pkg/cli/alpha/update.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ Conflicts:
5353
Other options:
5454
• --restore-path: restore paths from base when squashing (e.g., CI configs).
5555
• --output-branch: override the output branch name.
56-
• --commit-message: custom commit message for clean merges.
57-
• --commit-message-conflict: custom commit message for merges with conflicts.
56+
• --merge-message: custom commit message for clean merges.
57+
• --conflict-message: custom commit message for merges with conflicts.
5858
• --push: push the output branch to 'origin' after the update.
5959
• --git-config: pass per-invocation Git config as -c key=value (repeatable). When not set,
6060
defaults are set to improve detection during merges.
@@ -86,8 +86,8 @@ Defaults:
8686
8787
# Use custom commit messages for both scenarios
8888
kubebuilder alpha update --force \
89-
--commit-message "chore: upgrade kubebuilder scaffold" \
90-
--commit-message-conflict "chore: upgrade with conflicts - manual review needed"
89+
--merge-message "chore: upgrade kubebuilder scaffold" \
90+
--conflict-message "chore: upgrade with conflicts - manual review needed"
9191
9292
# Create an issue and add an AI overview comment
9393
kubebuilder alpha update --open-gh-issue --use-gh-models
@@ -163,10 +163,10 @@ Defaults:
163163
"Override the default output branch name (default: kubebuilder-update-from-<from-version>-to-<to-version>).")
164164
updateCmd.Flags().BoolVar(&opts.Push, "push", false,
165165
"Push the output branch to the remote repository after the update.")
166-
updateCmd.Flags().StringVar(&opts.CommitMessage, "commit-message", "",
166+
updateCmd.Flags().StringVar(&opts.CommitMessage, "merge-message", "",
167167
"Custom commit message for successful merges (no conflicts). "+
168168
"Defaults to 'chore(kubebuilder): update scaffold <from> -> <to>'.")
169-
updateCmd.Flags().StringVar(&opts.CommitMessageConflict, "commit-message-conflict", "",
169+
updateCmd.Flags().StringVar(&opts.CommitMessageConflict, "conflict-message", "",
170170
"Custom commit message for merges with conflicts. "+
171171
"Defaults to 'chore(kubebuilder): (:warning: manual conflict resolution required) update scaffold <from> -> <to>'.")
172172
updateCmd.Flags().BoolVar(&opts.OpenGhIssue, "open-gh-issue", false,

0 commit comments

Comments
 (0)