| name | github-update-pr |
| description | Push branch commits and update the existing PR body safely (prefer REST API) |
| triggers | ["Use the skill `github-update-pr`","Refresh the existing pull request description","Update the PR body to match the latest diff"] |
| license | Proprietary |
| metadata | {"author":"codiplab","version":"0.4.1"} |
What I do
- Validate changes locally.
- Push the current branch (handles unset upstream).
- Detect the PR for the current branch.
- Regenerate the PR body from
.github/PULL_REQUEST_TEMPLATE.md using the current main...HEAD diff.
- Update the PR body using
gh pr update (fallback to gh api).
When to use me
Use this when you already have a PR open and need to refresh its description to match the latest branch changes.
Process
- Run
task validate
- Collect context:
git diff main...HEAD --stat
git diff main...HEAD
git log main...HEAD --oneline
- Push current branch:
- If upstream is not set:
git push -u origin HEAD
- Otherwise:
git push
- Detect PR:
- Prefer:
gh pr view "$(git rev-parse --abbrev-ref HEAD)" --json number,title,url
- Fallback:
gh pr list --head "$(git rev-parse --abbrev-ref HEAD)" --json number,title,url
- Generate updated PR body (based on
.github/PULL_REQUEST_TEMPLATE.md) and fill:
- Proposed changes: bullets derived from
main...HEAD diff (group by area; reference key paths)
- Testing: include
task validate
- Migration steps (if any)
- Screenshots placeholders
- Types of changes: mark what applies
- Checklist: mark what is true
- Update PR body:
gh pr edit <PR_NUMBER> --body "$(cat <<'EOF'
<filled template body>
EOF
)"
owner="$(gh repo view --json owner --jq '.owner.login')"
repo="$(gh repo view --json name --jq '.name')"
gh api "repos/${owner}/${repo}/pulls/<PR_NUMBER>" \
--method PATCH \
--field body="$(cat <<'EOF'
<filled template body>
EOF
)"