gh-update-pr

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Update PR via REST API

通过REST API更新PR

gh pr edit
is broken due to GitHub deprecating Projects Classic (
projectCards
GraphQL field error). Use the REST API instead.
由于GitHub弃用Projects Classic(出现
projectCards
GraphQL字段错误),
gh pr edit
命令已无法正常工作。请改用REST API。

Rules

规则

  1. Never use
    gh pr edit
    to update PR title or body. It will fail with a GraphQL error.
  2. Use
    gh api
    with the REST endpoint:
    bash
    gh api repos/{owner}/{repo}/pulls/{number} -X PATCH -f title="..." -f body="..." --jq '.html_url'
  3. To get the current PR number and repo, use:
    bash
    gh pr view --json number,url,baseRefName
  4. gh pr view
    and
    gh pr create
    still work fine. Only
    gh pr edit
    is affected.
  1. **切勿使用
    gh pr edit
    **来更新PR标题或正文,否则会出现GraphQL错误。
  2. 使用
    gh api
    调用REST端点:
    bash
    gh api repos/{owner}/{repo}/pulls/{number} -X PATCH -f title="..." -f body="..." --jq '.html_url'
  3. 要获取当前PR编号和仓库信息,使用:
    bash
    gh pr view --json number,url,baseRefName
  4. gh pr view
    gh pr create
    仍可正常使用,仅
    gh pr edit
    受影响。