搜索

PythonReactSEOPDF
GitHub Skill

update-pr

Update a pull request description. Use when asked to update PR description, edit PR body, or refresh PR details.

kristofferremback☆ 1 仓库 Stars0 仓库 Forks

安装与使用

请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。

查看来源 ↗使用指南

技能说明

Update Pull Request Description

Update an existing PR's description, working around sandbox heredoc limitations.

Instructions

1. Get current PR info
# View current PR (assumes on feature branch)
gh pr view --json number,title,body

# Or specify PR number
gh pr view 123 --json number,title,body
2. Write the new body to a temp file

Use printf to avoid heredoc issues:

printf '%s\n' \
  '## Problem' \
  '' \
  'Description of the problem...' \
  '' \
  '## Solution' \
  '' \
  'Description of the solution...' \
  > /tmp/claude/pr-body.md

For longer content, build it incrementally:

# Start fresh
> /tmp/claude/pr-body.md

# Add sections
printf '%s\n' '## Problem' '' >> /tmp/claude/pr-body.md
printf '%s\n' 'The issue is...' '' >> /tmp/claude/pr-body.md
printf '%s\n' '## Solution' '' >> /tmp/claude/pr-body.md
printf '%s\n' 'We fixed it by...' >> /tmp/claude/pr-body.md
3. Update the PR
# Using body-file (may show GraphQL warning but still works)
gh pr edit 123 --body-file /tmp/claude/pr-body.md

# If that fails, use the API directly
gh api repos/{owner}/{repo}/pulls/123 --method PATCH \
  -f body="$(cat /tmp/claude/pr-body.md)"
4. Verify the update
gh pr view 123 --json body -q '.body' | head -20
5. Clean up
rm /tmp/claude/pr-body.md

Common Issues

GraphQL Projects (classic) warning: This warning appears but the update usually still succeeds. Verify with gh pr view.

Heredoc fails: Expected in sandbox mode. Use printf approach.

Body too long for single printf: Build the file incrementally with append (>>).

Special characters: Use single quotes. For apostrophes: 'Don'\''t'

PR Body Structure

Follow this template for consistency:

## Problem

[What issue exists?]

## Solution

[High-level approach]

### Key design decisions

**1. [Decision]**
[Explanation]

## Files changed

| File           | Change      |
| -------------- | ----------- |
| `path/file.ts` | Description |

## Test plan

- [ ] Test item

---

🤖 _PR by [Claude Code](https://claude.com/claude-code)_

Examples

Quick body update:

printf '%s\n' '## Problem' '' 'Users cannot login' '' '## Solution' '' 'Fixed auth token validation' '' '---' '🤖 _PR by [Claude Code](https://claude.com/claude-code)_' > /tmp/claude/pr-body.md
gh pr edit 123 --body-file /tmp/claude/pr-body.md

Using API fallback:

gh api repos/myorg/myrepo/pulls/123 --method PATCH \
  -f body="$(cat /tmp/claude/pr-body.md)"

使用示例

查看来源仓库中的使用示例与配置说明。

查看来源 ↗

来源历史

收录时间
2026-01-20
索引更新时间
2026-01-26
Branch
main

收录与同步日期属于本站记录。源码修改历史请查看来源仓库。

GitHub ↗

chat Comments (0)

chat_bubble_outline

No comments yet. Be the first to share your thoughts!