Skip to content

Commit af37357

Browse files
committed
adding merge command
1 parent 5ada255 commit af37357

File tree

5 files changed

+728
-9
lines changed

5 files changed

+728
-9
lines changed

docs/doc/release-bot.md

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,30 @@ Publishes a specific version or auto-detects from issue.
147147
148148
**Use case**: Ready to publish a prepared release.
149149
150+
#### `/release-bot merge [version]`
151+
152+
Merges the PR, marks the release as published, and closes the issue in one step.
153+
154+
```
155+
/release-bot merge
156+
/release-bot merge 1.2.3
157+
/release-bot merge version=1.2 issue=42
158+
```
159+
160+
**Use case**: Finalize a release by merging PR, publishing release, and closing tracking issue.
161+
162+
**Workflow**: merge PR → mark release published → close issue
163+
164+
**Auto-detection**:
165+
1. Version from issue association or partial match
166+
2. PR from issue references or release branch
167+
3. Issue from version association
168+
169+
**Behavior**:
170+
- Idempotent: Skips already-completed steps
171+
- Safe: Shows clear status for each operation
172+
- Flexible: Works with full or partial versions
173+
150174
**Version detection**:
151175
1. Specified version parameter
152176
2. Database lookup by issue number
@@ -269,10 +293,10 @@ The bot uses three release modes depending on the context:
269293
release-tool push 1.2.3 --release-mode published
270294
```
271295

272-
### Just-Publish Mode (New)
296+
### Mark-Published Mode
273297

274298
```bash
275-
--release-mode just-push
299+
--release-mode mark-published
276300
```
277301

278302
**Purpose**: Mark existing draft as published without modifications
@@ -291,7 +315,7 @@ release-tool push 1.2.3 --release-mode published
291315

292316
**Example**:
293317
```bash
294-
release-tool push 1.2.3 --release-mode just-push
318+
release-tool push 1.2.3 --release-mode mark-published
295319
```
296320

297321
**Error handling**:
@@ -316,10 +340,10 @@ Use --release-mode published or draft to create a new release
316340
Bot creates PR with release notes
317341
Team reviews changes
318342

319-
3. **Merge PR** (Automatic just-push)
343+
3. **Merge PR** (Automatic mark-published)
320344
PR merges → Bot runs:
321345
```bash
322-
release-tool push 1.2.3 --release-mode just-push
346+
release-tool push 1.2.3 --release-mode mark-published
323347
```
324348
Result: Draft marked as published
325349

@@ -469,7 +493,7 @@ on:
469493
/release-bot publish 1.2.3
470494
```
471495
472-
### Just-Publish Fails with "No existing release"
496+
### Mark-Published Fails with "No existing release"
473497
474498
**Symptoms**: PR merge fails with error
475499

docs/doc/usage.md

Lines changed: 86 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,13 @@ release-tool push 9.1.0 --release-mode draft
103103
release-tool push 9.1.0 --release-mode published
104104

105105
# Mark existing release as published (no tag operations)
106-
release-tool push 9.1.0 --release-mode just-push
106+
release-tool push 9.1.0 --release-mode mark-published
107107
```
108108

109109
**Mode Details**:
110110
- `draft`: Creates GitHub release with `draft: true` (not public)
111111
- `published`: Creates/updates full release with tags and notes
112-
- `just-push`: Only marks existing release as published (no tag/note changes)
112+
- `mark-published`: Only marks existing release as published (no tag/note changes)
113113
- ✅ Perfect for automation (e.g., PR merge triggers)
114114
- ✅ Preserves all existing release properties
115115
- ❌ Fails if no existing release found
@@ -187,6 +187,88 @@ release-tool push 9.1.0 --prerelease false # Force stable
187187
release-tool push 9.1.0 --prerelease auto # Auto-detect
188188
```
189189

190+
### 5. Merge Release
191+
192+
The `merge` command automates the final steps of the release process by:
193+
1. Merging the associated PR (if not already merged)
194+
2. Marking the release as published (from draft to published)
195+
3. Closing the related issue (if not already closed)
196+
197+
This is particularly useful for finalizing a release in one atomic operation.
198+
199+
#### Basic Usage
200+
201+
```bash
202+
# Merge with auto-detection from issue
203+
release-tool merge --issue 42
204+
205+
# Specify full version
206+
release-tool merge 1.2.3 --issue 42
207+
208+
# Specify partial version (auto-completes)
209+
release-tool merge 1.2 --issue 42
210+
211+
# Explicitly specify PR number
212+
release-tool merge 1.2.3 --pr 123 --issue 42
213+
214+
# Dry-run to preview actions
215+
release-tool merge 1.2.3 --issue 42 --dry-run
216+
```
217+
218+
#### Auto-Detection
219+
220+
The merge command intelligently auto-detects missing information:
221+
222+
**Version Detection**:
223+
- From issue association in database
224+
- From partial version match (finds matching full versions with open PR/issue)
225+
- Shows first 5 matches if multiple found (prompts for selection or uses first with `--auto`)
226+
227+
**PR Detection**:
228+
- From PRs referencing the provided issue number
229+
- Searches both open and closed PRs
230+
231+
**Issue Detection**:
232+
- From version association in database
233+
234+
#### Behavior
235+
236+
**Idempotent**: Gracefully skips already-completed steps:
237+
- If PR is already merged, continues to mark release published
238+
- If release is already published, continues to close issue
239+
- If issue is already closed, completes successfully
240+
241+
**Safe**: Shows clear status for each operation
242+
**Flexible**: Works with full or partial versions
243+
244+
#### Examples
245+
246+
**Example 1: Full workflow from issue**
247+
```bash
248+
# Auto-detect version, PR, and complete merge
249+
release-tool merge --issue 42
250+
```
251+
252+
**Example 2: Partial version with auto-completion**
253+
```bash
254+
# Finds matching versions starting with "1.2"
255+
release-tool merge 1.2 --issue 42
256+
257+
# If multiple matches:
258+
# 1.2.0 (Issue #42, PR #123)
259+
# 1.2.1 (Issue #45, PR #124)
260+
# Select a number (or 'c' to cancel): 1
261+
```
262+
263+
**Example 3: Preview before executing**
264+
```bash
265+
release-tool merge 1.2.3 --issue 42 --dry-run
266+
# Output shows:
267+
# Step 1: Would merge PR #123
268+
# Step 2: Would mark release 1.2.3 as published
269+
# Step 3: Would close issue #42
270+
```
271+
190272
## Common Commands
191273

192274
| Command | Description |
@@ -197,9 +279,10 @@ release-tool push 9.1.0 --prerelease auto # Auto-detect
197279
| `generate --dry-run` | Preview generated notes without creating files |
198280
| `list-releases` | Lists releases from the database with filters |
199281
| `publish <version>` | Creates a GitHub release (auto-finds draft notes) |
282+
| `merge [version]` | Merges PR, marks release published, and closes issue in one step |
200283
| `publish <version> -f <file>` | Creates a GitHub release from a markdown file |
201284
| `publish <version> --issue <number>` | Associate release with a GitHub issue |
202-
| `publish <version> --release-mode draft\|published\|just-push` | Control release creation mode |
285+
| `publish <version> --release-mode draft\|published\|mark-published` | Control release creation mode |
203286
| `publish --list` or `publish -l` | List all available draft releases |
204287
| `publish --dry-run` | Preview publish operation without making changes |
205288
| `publish --debug` | Show detailed debugging information |

0 commit comments

Comments
 (0)