Skip to content

feat(desktop): add --merge flag to release script#884

Merged
Kitenite merged 4 commits intomainfrom
feat/release-script-merge-flag
Jan 22, 2026
Merged

feat(desktop): add --merge flag to release script#884
Kitenite merged 4 commits intomainfrom
feat/release-script-merge-flag

Conversation

@Kitenite
Copy link
Copy Markdown
Collaborator

@Kitenite Kitenite commented Jan 22, 2026

Summary

  • Add optional --merge flag to the release script that merges the release PR and deletes the branch after publishing
  • Track PR number throughout the script so it can be merged at the end
  • Fix release notes generation to use the correct previous desktop tag (e.g., desktop-v0.0.58desktop-v0.0.59) so "What's Changed" only shows desktop-related changes

Usage

./create-release.sh --publish          # Publish release only
./create-release.sh --publish --merge  # Publish and merge PR

Test plan

  • Run release script without --merge flag, verify PR is not merged
  • Run release script with --merge flag, verify PR is merged and branch deleted
  • Verify release notes show changes only since the previous desktop release

Summary by CodeRabbit

  • New Features

    • Added --merge command-line option to automatically merge pull requests after release publication.
  • Chores

    • Version updated to 0.0.60.
    • Enhanced release workflow for improved release notes generation with better version tag tracking.

✏️ Tip: You can customize this high-level summary in your review settings.

Add optional --merge flag that merges the release PR and deletes the
branch after publishing. This allows for a fully automated release
workflow when used with --publish --merge.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 22, 2026

📝 Walkthrough

Walkthrough

The desktop release flow adds an optional --merge flag to apps/desktop/create-release.sh, which tracks a PR_NUMBER and, after publishing a release, conditionally squash-merges and deletes the release branch when requested.

Changes

Cohort / File(s) Summary
Release script merge feature
apps/desktop/create-release.sh
Added --merge CLI flag and AUTO_MERGE variable; capture/propagate PR_NUMBER from existing or newly created PR; after publishing, conditionally squash-merge the PR and delete its branch; updated usage and argument parsing.
GitHub Actions release workflow
.github/workflows/release-desktop.yml
Use fetch-depth: 0; added step to compute previous_tag and output tags; generate release notes via gh api using previous_tag if present; replace softprops release action with gh release create using GH_TOKEN and notes file; keep artifact and stable-copy steps.
Desktop package manifest
apps/desktop/package.json
Bumped version from 0.0.59 to 0.0.60.

Sequence Diagram(s)

sequenceDiagram
    participant Script as "create-release.sh"
    participant GHCLI as "gh (GitHub CLI)"
    participant GitHub as "GitHub API / Repo"

    Script->>GHCLI: check for existing PR / create PR
    GHCLI->>GitHub: list/create PR (returns PR URL)
    GitHub-->>GHCLI: PR URL (contains PR_NUMBER)
    GHCLI-->>Script: PR_NUMBER
    Script->>GHCLI: publish release (gh release create with notes)
    GHCLI->>GitHub: create draft release
    GitHub-->>GHCLI: release created
    alt AUTO_MERGE true and PR_NUMBER present
        Script->>GHCLI: squash-merge PR (gh pr merge --squash --delete-branch)
        GHCLI->>GitHub: merge PR and delete branch
        GitHub-->>GHCLI: merge result
        GHCLI-->>Script: merge success/failure
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I hopped into code with a tiny cheer,

A --merge flag to finish the rear,
PR numbers tracked, branches set free,
Squash and delete — tidy as can be,
A small rabbit dance for release-day glee.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive The PR description covers the main changes and usage, but lacks formal sections matching the repository template. Use the template structure with sections for Type of Change and Testing details to ensure consistency with repository standards.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main feature being added: an optional --merge flag to the release script.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/desktop/create-release.sh (1)

86-110: Prevent --merge from silently no-op’ing without --publish.

Right now --merge can be passed alone and nothing happens, which is surprising. Consider a hard validation so users learn the dependency early.

🔧 Suggested guard
 for arg in "$@"; do
@@
     esac
 done
+
+if [ "$AUTO_MERGE" = true ] && [ "$AUTO_PUBLISH" != true ]; then
+    error "--merge requires --publish (merge occurs only after publishing)."
+fi
🧹 Nitpick comments (2)
apps/desktop/create-release.sh (2)

283-305: Avoid parsing PR numbers from free‑form output.

grep -oE '[0-9]+$' is brittle if gh pr create emits additional lines or warnings. Consider querying the PR number via gh pr view or reusing gh pr list --head after creation for a deterministic result.

♻️ More robust PR number retrieval
         if [ $? -eq 0 ]; then
             success "Pull request created: ${PR_URL}"
-            # Extract PR number from URL
-            PR_NUMBER=$(echo "$PR_URL" | grep -oE '[0-9]+$')
+            # Resolve PR number from GitHub rather than parsing output
+            PR_NUMBER=$(gh pr view "$PR_URL" --json number --jq .number 2>/dev/null || echo "")
         else
             warn "Could not create PR: ${PR_URL}"
         fi

409-417: Consider warning when merge is requested but no PR is available.

If --merge is set but PR_NUMBER is empty (e.g., on main or PR creation failed), the script silently skips merging. A short warning would reduce confusion.

🔔 Optional UX improvement
-        if [ "$AUTO_MERGE" = true ] && [ -n "$PR_NUMBER" ]; then
+        if [ "$AUTO_MERGE" = true ] && [ -n "$PR_NUMBER" ]; then
             info "Merging PR #${PR_NUMBER}..."
             if gh pr merge "${PR_NUMBER}" --squash --delete-branch; then
                 success "PR #${PR_NUMBER} merged and branch deleted"
             else
                 warn "Could not merge PR #${PR_NUMBER}. You may need to merge it manually."
             fi
+        elif [ "$AUTO_MERGE" = true ]; then
+            warn "Auto-merge requested, but no PR number was detected."
         fi

Find the previous desktop release tag (e.g., desktop-v0.0.58 for
desktop-v0.0.59) when generating release notes, so the "What's Changed"
section only includes changes since the last desktop release.

Uses GitHub API to generate release notes with the correct previous tag
comparison instead of comparing against the most recent tag of any type.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 22, 2026

🚀 Preview Deployment

🔗 Preview Links

Service Status Link
Neon Database (Neon) View Branch
Fly.io Electric (Fly.io) View App
Vercel API (Vercel) Open Preview
Vercel Web (Vercel) Open Preview
Vercel Marketing (Vercel) Open Preview
Vercel Admin (Vercel) Open Preview
Vercel Docs (Vercel) Open Preview

Preview updates automatically with new commits

@Kitenite Kitenite merged commit cd333bf into main Jan 22, 2026
12 checks passed
@Kitenite Kitenite deleted the feat/release-script-merge-flag branch January 22, 2026 01:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant