Land

From indigoai-us/hq-core · View interactive version

Land is an AI agent skill from the GitHub repository indigoai-us/hq-core. Land a PR: watch CI, resolve review issues, merge, verify production. Triggers: \"land this\", \"merge and monitor\".

How to use this skill

Skill file

Land

Monitor CI → Resolve reviews → Merge → Monitor production.

This skill takes a PR from "open" to "merged and verified in production." It handles the full landing sequence, including CI polling, review resolution, merge strategy selection, and post-merge production verification.

Input

Accepts one of:

Step 0: Resolve PR

# If no PR number/URL given:
branch=$(git branch --show-current)
gh pr list --head "$branch" --json number,url --jq '.[0]'

# Resolve exact head SHA, draft/mergeable state, and repo auto-merge support:
gh pr view {pr_number} -R {repo} --json number,title,headRefName,baseRefName,headRefOid,isDraft,mergeable,reviewDecision
gh api repos/{repo} --jq '{allow_auto_merge, delete_branch_on_merge}'

Extract: repo, pr_number, branch, base_branch, head_sha, allow_auto_merge. Anchor every gh call with -R {repo}.

Display:

Landing PR #{number}: {title}
Branch: {branch} → {base} (head {head_sha[:8]})

Step 1: Resolve Reviews Before or Alongside CI

Check reviews and review threads immediately so a clean PR never waits past green CI:

gh pr view {pr_number} -R {repo} --json reviews,comments,reviewRequests,reviewThreads

Outcomes:

Step 2: Arm Auto-Merge or Watch CI

Never busy-wait in a foreground poll loop with a short timeout (a 10-minute foreground cap drops PRs whose CI takes longer).

Check policy gates before arming or merging:

Path A: GitHub Auto-Merge (preferred when `allow_auto_merge: true`)

If the PR is ready (not draft), reviews and policy gates are satisfied, and the ruleset's approval requirement is already met (either required_approving_review_count: 0 or a valid non-author approval is on the PR):

gh pr merge {pr_number} -R {repo} --auto --squash --delete-branch --match-head-commit {head_sha}

Use --merge instead of --squash only if the user requested it or the repo preserves branch commit history.

Verify auto-merge is armed, then wait in the background (or monitor gh pr checks {pr_number} -R {repo} --watch) until state is MERGED or a check fails:

Path B: Background CI Watch + Direct Merge (when `--auto` cannot fire)

Use this path only when allow_auto_merge is false, or when a ruleset requires a review approval that is satisfied via an authorized bypass (GitHub auto-merge does not invoke ruleset bypass actors):

  1. Watch checks in the background (never a 10-minute foreground sleep loop):

```bash

gh pr checks {pr_number} -R {repo} --watch

```

  1. Once every required check is green on {head_sha}, merge pinned to that exact commit:

```bash

gh pr merge {pr_number} -R {repo} --squash --delete-branch --match-head-commit {head_sha}

```

Add --admin only when the user has authorized admin bypass and only for a review-only gate — never to bypass failing or pending required checks.

Step 3: Verify Merge

gh pr view {pr_number} -R {repo} --json state,mergedAt,mergeCommit

Step 4: Monitor Production

Post-merge verification. This step is context-dependent — the skill adapts based on what was changed.

4a: Identify what to monitor

From the PR diff, determine:

4b: Execute monitoring

For Lambda changes ({PRODUCT} pattern):

For deployed services (Vercel, etc.):

For database/data fixes:

4c: Report

Landing Complete
────────────────
PR: #{number} merged → {merge_commit[:8]}
CI: All {N} checks passed
Reviews: {resolved|none}
Merge: squash → {base_branch}
Production: {status}
  - {monitoring_detail_1}
  - {monitoring_detail_2}

If production verification reveals issues, flag immediately and offer to investigate.

Error Handling

Rules

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.