Skip to content
Back to skills

Land Pr

ASecurity

Merge a green PR to main and verify CI succeeds (staging deploy + draft releases). Use when the user says "merge", "land", "land PR", "merge this", or when a PR has passed CI and is ready to merge. This does NOT deploy to production — use /release-app for that.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 12, 2026
testinggobashgitapidatabase

Works with

  • api

Security analysis

A100/100

Scanned November 12, 2026

npx -y skills add ZenUml/conf-app --skill land-pr --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Land Pr?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Land Pr
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/zenuml-land-pr/badge)](https://www.skillsdirectory.com/skills/zenuml-land-pr)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: land-pr
description: Merge a green PR to main and verify CI succeeds (staging deploy + draft releases). Use when the user says "merge", "land", "land PR", "merge this", or when a PR has passed CI and is ready to merge. This does NOT deploy to production — use /release-app for that.
---

# Land PR

Merge a green PR to `main` and verify CI succeeds. In this repo, **merge to main triggers staging deploys and creates draft releases** — it does NOT deploy to production. Production release is a separate step via `/release-app`.

## What happens on merge to main

1. Build + unit tests
2. Deploy all 3 variants (lite, full, diagramly) to Cloudflare staging
3. Run E2E tests against staging Confluence instances
4. Create draft GitHub releases for each variant (lite, full, diagramly)

Production deployment requires manually publishing those draft releases (or using `/release-app`).

## Preconditions

```bash
gh pr view <PR_NUMBER> --json state,isDraft,mergeable,statusCheckRollup,reviewDecision
```

Verify ALL of these:

1. **PR is the right one** — confirm PR number with the user if ambiguous
2. **No pending reviews** — no requested changes outstanding
3. **Branch is up to date** — no merge conflicts with main
4. **CI is green AFTER the Draft gate is lifted** — see Step 1 below

If a precondition fails (other than Draft), report which one and stop.

## Steps

### 1. Lift the Draft gate if needed

If `isDraft === true`, this PR has not been E2E-verified (the Draft gate skips `E2E: Lite`). `/land-pr` means "I want this merged" — so flip it Ready, wait for the resulting CI run with E2E to go green, then merge. Don't refuse and don't merge without verification.

```bash
gh pr ready <PR_NUMBER> --repo ZenUml/conf-app
```

Tell the user: "PR is Draft → marking Ready and waiting for CI (~14 min) to verify E2E before merge."

Then delegate to `/babysit-pr <PR>` (or watch inline). If the new CI run fails, stop and report — do not merge.

If `isDraft === false` already, skip this step.

### 2. Verify CI green

Confirm CI is green and `E2E: Lite` is among the passed checks (not skipped). Re-run the precondition checks. If anything is not green, stop and report.

### 3. Merge

Fetch the repo's enabled merge strategies and pick the right flag (GitHub requires one when multiple strategies are enabled):

```bash
MERGE_FLAG=$(gh api repos/ZenUml/conf-app \
  --jq 'if .allow_squash_merge and (.allow_merge_commit | not) and (.allow_rebase_merge | not) then "--squash"
        elif .allow_rebase_merge and (.allow_merge_commit | not) and (.allow_squash_merge | not) then "--rebase"
        else "--merge" end')

gh pr merge <PR_NUMBER> --auto --delete-branch $MERGE_FLAG
```

Logic: use `--squash` if only squash is enabled, `--rebase` if only rebase is enabled, otherwise `--merge` (GitHub's default when multiple strategies are on). Do not override with `--squash` or `--rebase` unless the user explicitly requests it.

**NEVER pass `--delete-branch` while another open PR uses this branch as its base.** Deleting the base branch makes GitHub **close** the stacked child PR, and a closed PR can be neither reopened (`reopenPullRequest` fails) nor retargeted (`Cannot change the base branch of a closed pull request`) — the only recovery is recreating it, losing its number, review history, and comments. Check first, and drop the flag if anything comes back:

```bash
HEAD_REF=$(gh pr view <PR_NUMBER> --repo ZenUml/conf-app --json headRefName -q .headRefName)
gh pr list --repo ZenUml/conf-app --state open --base "$HEAD_REF" --json number,title
```

Correct order for a stack: merge the parent **without** `--delete-branch` → retarget each child (`gh api -X PATCH repos/ZenUml/conf-app/pulls/<child> -f base=main`; the `gh pr edit --base` path can silently no-op) → then `git push origin --delete "$HEAD_REF"`.

_(2026-07-29: merging #409 with `--delete-branch` closed stacked #410; it had to be recreated as #412.)_

Using `--auto` arms auto-merge so GitHub merges when all checks pass.

### 4. Wait for merge

```bash
gh pr view <PR_NUMBER> --json state
```

Poll until state is `MERGED`. Timeout after 5 minutes.

### 5. Monitor CI on main

After merge, the `Build, Test and Draft Release` workflow runs on main. Watch it:

```bash
gh run list --repo ZenUml/conf-app --branch main --limit 1 --json databaseId,status,conclusion
gh run watch <RUN_ID> --repo ZenUml/conf-app
```

### 5. Verify draft releases created

```bash
gh release list --repo ZenUml/conf-app --limit 4
```

Confirm draft releases were created for the expected variants.

### 6. Name the next release step in canary order

Before offering any production release, invoke the **release-app** skill in `preflight` mode (read-only) and read its canary order ("Variants & gates"). Do not compose release options from memory.

The order is **diagramly → lite → full**: Diagramly first (canary, fewest users); Lite only after Diagramly is published for the same commit SHA (same session allowed); Full only ≥ 24 hours after Lite for that SHA, never in the same session. AsyncAPI is independent. Offer the release options in that order, recommend Diagramly first, and never offer Lite or Full as the first step. Publishing still needs an explicit user trigger.

_(2026-09-15: after landing #689 the report offered "release Lite" first, skipping the Diagramly canary.)_

## Output

Report one of:

- **LANDED** — merged, staging deployed, draft releases created; next release step named per Step 6
- **MERGE BLOCKED** — which precondition failed
- **CI FAILED** — merged but CI failed on main, with error details

## On CI failure on main

**Do NOT auto-rollback.** Report:

1. The merge commit SHA
2. The failing workflow run URL
3. Which job failed (build, staging deploy, E2E, or draft release)
4. The error output

The user decides whether to hotfix or revert.

## Does NOT

- Deploy to production (use `/release-app` for that)
- Fix CI failures
- Create PRs (use `/submit-branch`)
- Run local tests (use `/validate-branch`)

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in testing →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.