# 合并并部署 (land-and-deploy)

> 接手 /ship 创建的 GitHub PR：检查 CI 与合并就绪，经批准后合并，监控部署，验证生产环境并输出部署报告。

- 分类: [部署与发布](https://www.myskills.tools/zh/categories/deploy-release/)
- 来源: 社区 · Garry Tan
- 代码仓库: https://github.com/garrytan/gstack/tree/main/land-and-deploy (commit a77fae2 · v1.0.0)
- SKILL.md: https://github.com/garrytan/gstack/blob/main/land-and-deploy/SKILL.md
- 安装命令: `npx skills add garrytan/gstack --skill land-and-deploy`
- 许可证: MIT
- 兼容工具: Claude Code, Codex, Cursor, Copilot
- 权限: read-repo ✓, write-files ✓, shell ✓, network ✓
- 状态: 扫描通过
- 规则扫描无法覆盖所有风险，安装前请阅读此技能的 SKILL.md，确认权限后再使用。
- ⚠ 会合并 PR、删除分支，回滚时向基准分支推送 revert 提交；需要已登录的 gh，且仅支持 GitHub。

## 核心规则

绝不强制推送、绕过 CI、重复已确认的合并或隐瞒缺失的证据。

## 执行阶段

1. **预检与 PR 定位** — 确认 gh 已登录，定位 PR 及其基准分支，并要求本地检出与 PR 头提交一致且干净；首次运行先做演练验证。
2. **CI 与就绪检查** — 检查当前头提交上的所有 CI、合并冲突和 VERSION 漂移，必要时等待 CI，再通过合并前就绪关卡。
3. **合并并等待部署** — 用户批准后合并，识别部署方式，并通过 GitHub Actions 或 Fly.io、Heroku 等平台确认对应修订已部署。
4. **金丝雀验证** — 检查生产网址的健康状况；若失败，经用户明确选择后通过 revert 提交回滚。
5. **部署报告** — 按证据给出结论，如“已部署并验证”或“已合并（未验证）”，保存报告到 .gstack/deploy-reports/ 并建议后续操作。

## 权限说明（据 SKILL.md 整理）

| 能力 | 是否需要 | 说明 |
|---|---|---|
| 文件写入 | 部分需要 | 写入 .gstack/ 下的部署报告和临时文件，以及 gstack 状态目录中的确认记录和日志；合并前不修改代码。 |
| 命令执行 | 需要 | 运行 git、gh、jq、gstack 辅助脚本以及 fly、heroku 等平台状态命令，并可执行合并、revert 和推送。 |
| 网络外发 | 部分需要 | 访问 GitHub（gh、git fetch/push）、部署平台的状态接口和待验证的生产网址；并记录 gstack 遥测。 |

## SKILL.md 头部信息（YAML）

```yaml
---
name: land-and-deploy
preamble-tier: 4
version: 1.0.0
description: Land and deploy workflow. (gstack)
allowed-tools:
  - Bash
  - Read
  - Write
  - Glob
  - AskUserQuestion
triggers:
  - merge and deploy
  - land the pr
  - ship to production
---
```

首页: https://www.myskills.tools/zh/ · URL: https://www.myskills.tools/zh/skills/land-and-deploy/
