Update the current PR description to reflect branch changes, using an optional date or commit as the starting point and the PR base branch by default.
This skill will:
- Get the current PR description and save it as the “current” version
- Analyze git commits since the specified date/commit to identify new changes
- Generate an updated PR description that incorporates these changes
- Use your git diff tool to show the difference between current and proposed descriptions
- If approved, update the PR with the new description
Arguments provided: $ARGUMENTS
Codex: if the invocation text above is not populated, use the text after the skill name. If none is available, infer an optional date, commit hash, or --force flag from the current request.
Arguments:
- Date/Commit Hash: Specify either a date (e.g., “2025-01-15”, “2025-01-15T10:30:00”) or commit hash (e.g., “abc123f”) to find commits since that point
- –force: Regenerate entire PR description from scratch, analyzing all commits in the branch
Project Conventions (optional):
If the CODE_CONVENTIONS environment variable is set and points to a readable file, skim it for context about project patterns that should be reflected in the PR description (e.g., architecture decisions, naming conventions).
Process:
- Create a unique temporary directory, then get current PR info and save the description:
tmp_dir="$(mktemp -d)" gh pr view --json body --jq '.body' > "$tmp_dir/current-pr-description.md" - Parse arguments and find commits:
- If
--forceis provided: analyze all commits in the current branch - If a date is provided (contains
-or:): usegit log --since="date" --oneline - If a commit hash is provided: use
git log commit-hash..HEAD --oneline - If no argument is provided: get the PR’s base branch with
gh pr view --json baseRefName --jq '.baseRefName', fetch/verify the correspondingorigin/<base>ref, and analyzeorigin/<base>...HEAD - Determine argument type by checking format:
- Date formats:
YYYY-MM-DD,YYYY-MM-DDTHH:MM:SS, etc. - Commit hash: 7+ character alphanumeric string
- Date formats:
- If
- Generate updated PR description:
- Follow the project’s established PR-description process and repository instructions
- Incorporate information about new commits and changes
- Create diff and review:
- Save the proposed description to
$tmp_dir/proposed-pr-description.md - Always show a textual comparison with
git diff --no-index -- "$tmp_dir/current-pr-description.md" "$tmp_dir/proposed-pr-description.md"; exit status 1 means the files differ and is expected -
Optionally use the user’s configured visual difftool when requested and available
- Wait for user approval before applying changes
- Save the proposed description to
-
Consider updating PR title Consider whether the title needs to be updated to reflect the changes. Default to keeping the original title.
- Update the PR:
Example commands to suggest:
gh pr edit --title "UPDATED_TITLE_HERE" --body-file "$tmp_dir/proposed-pr-description.md"(only include UPDATED_TITLE_HERE if it is different from the original title)
- Apply changes if approved:
- Use the above commands to update the PR description and title.
- After approval and a successful update, or after cancellation, remove only the unique temporary directory created in Step 1.
Usage Examples:
- Invoke
update-pr-descriptionwith2025-01-15to update from commits since January 15, 2025. - Invoke
update-pr-descriptionwith1764afeto update from that commit. - Invoke
update-pr-descriptionwith--forceto regenerate the entire description. - Invoke
update-pr-descriptionwith2025-01-15T10:30:00to update from a specific time.