Github pr body

From y-miyazaki/terraform-aws-base · View interactive version

Github pr body is an AI agent skill from the GitHub repository y-miyazaki/terraform-aws-base. Update PR body content with deterministic baseline sections and optional full-body completion. Use after a PR exists to fill or regenerate its body from the repository PR template.

How to use this skill

Skill file

Input

Output Specification

Return structured Markdown in accordance with references/common-output-format.md.

Structured PR output:

Execution Scope

USE FOR:

DO NOT USE FOR:

Reference Files Guide

Workflow

  1. Fetch PR metadata:

```bash

scripts/pr_fetch.sh <PR_NUMBER> --repo <OWNER/REPO>

```

Parse JSON output to obtain: title, body, file list, additions/deletions, headRefName, baseRefName.

  1. Generate deterministic baseline (## Overview, ## Changes):

```bash

scripts/pr_body.sh <PR_NUMBER> --repo <OWNER/REPO> --dry-run

```

Review dry-run output. If acceptable, apply:

```bash

scripts/pr_body.sh <PR_NUMBER> --repo <OWNER/REPO>

```

  1. Select mode:
  1. Generate AI-completed content (full-body mode only):

1. Read category-pr-body-guidelines.md. Read category-template-mapping.md when template comment guidance is ambiguous.

2. Read .github/PULL_REQUEST_TEMPLATE.md from the repository — the only template location pr_body.sh reads (root, docs/, and multi-template directories are not read).

3. For each H2 section in the template:

4. Replace the metadata-only ## Overview from Step 2 with a narrative Overview in the format of category-pr-body-guidelines.md § Overview Format (2–4 sentence paragraph plus Core Fixes:, Scope:, and Risk / Deployment Note: bullets); keep ## Changes from Step 2 output.

5. Write the complete PR body (all sections) to a temporary file in the location the consumer's rules designate for temporary files.

  1. Apply full body (full-body mode only):

```bash

scripts/pr_body.sh <PR_NUMBER> --repo <OWNER/REPO> --body-file <TEMP_FILE>

```

  1. Verify success:

```bash

gh pr view <PR_NUMBER> --repo <OWNER/REPO> --json body --jq '.body'

```

Confirm ## Overview and ## Changes sections are present and non-empty. In full-body mode, confirm every template H2 that carries guidance comments or examples contains visible content (e.g. ## Testing, ## Checklist).

Error Handling

| Condition | Severity | Action |

| ------------------------------------------ | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |

| gh not authenticated | Fatal | Stop; instruct gh auth login |

| PR not found (404) | Fatal | Verify PR number and owner/repo |

| Access denied (403) | Fatal | Verify repo write scope |

| pr_fetch.sh or pr_body.sh missing | Fatal | Stop; report missing script |

| .github/PULL_REQUEST_TEMPLATE.md missing | Fatal | Stop; the baseline run (Step 2, which both modes start with) exits with "Template file not found" — report it; --body-file alone does not read the template |

| Body exceeds GitHub size limit (422) | Recoverable | Truncate or split content; report in output |

| Rate limit exceeded (429) | Recoverable | Defer update; note retry window in report |

| Dry-run output unacceptable | Info | Do not apply; report diff issues and stop |

Examples

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.