github-pr-agent-workflows

Original🇺🇸 English
Translated
3 scripts

Manage GitHub pull request workflows for coding agents. Use when Codex needs to open, update, monitor, or hand off a PR; wait for CI checks or reviewer feedback; inspect unresolved review threads; address requested changes; summarize PR status; or decide whether to continue, wait, report a timeout, or ask for human input.

2installs
Added on

NPX Install

npx skill4agent add andreacovelli/my-skills github-pr-agent-workflows

GitHub PR Agent Workflows

Overview

Use this skill for agent-oriented pull request loops: prepare the PR, wait for checks, wait for review activity, inspect feedback, make follow-up changes, and report the final state. Prefer the bundled scripts for repeatable review polling and review-thread summaries.

Quick Commands

Watch checks, then review activity:
bash
scripts/pr-agent-watch.sh 123 -R OWNER/REPO --checks-timeout 30m --review-timeout 2h
Wait for review activity:
bash
scripts/wait-pr-review.sh 123 -R OWNER/REPO --timeout 30m --interval 60s
Summarize current review state:
bash
scripts/pr-review-summary.sh 123 -R OWNER/REPO
Print parseable review state:
bash
scripts/pr-review-summary.sh 123 -R OWNER/REPO --json
Wait for CI checks with
gh
:
bash
gh pr checks 123 -R OWNER/REPO --watch --interval 10
Use the system
timeout
command when a bounded check wait is required:
bash
timeout 30m gh pr checks 123 -R OWNER/REPO --watch --interval 10

Agent Loop

  1. Identify the PR and repository. Use
    gh pr view --json number,url,headRefName,baseRefName,reviewDecision,mergeStateStatus,statusCheckRollup
    or accept an explicit PR number and
    -R OWNER/REPO
    .
  2. Snapshot the PR before waiting. Run
    scripts/pr-review-summary.sh
    when review feedback may matter.
  3. Wait for CI when validation gates the next action. Use
    scripts/pr-agent-watch.sh
    when the agent should wait for checks and review feedback in one loop. Use
    gh pr checks --watch
    for checks-only waits.
  4. Wait for reviewer activity when the next action depends on feedback. Use
    scripts/wait-pr-review.sh
    ; prefer
    --ignore-existing
    after the agent has already handled current feedback.
  5. Inspect comments before editing. Use the review summary script, preferably with
    --json
    when automation needs to parse unresolved threads. Use
    gh pr view --comments
    or
    gh api repos/{owner}/{repo}/pulls/{pull_number}/comments --paginate
    when bodies or locations need deeper inspection.
  6. Address feedback in a small patch. Do not rewrite unrelated files. Preserve user changes in the worktree.
  7. Run the relevant checks locally. Keep validation proportional to the changed area.
  8. Push or report. Push only when that is part of the task. Merge only when the user explicitly asked for merge behavior.

Decision Rules

  • If checks fail, inspect the failing check logs before changing code.
  • If
    wait-pr-review.sh
    exits
    0
    , inspect review threads and review decisions before editing.
  • If
    wait-pr-review.sh
    exits
    124
    , report that no matching review activity arrived before the timeout.
  • If
    gh pr checks --watch
    exits because checks are still pending or the wrapper timeout fires, report the pending state instead of guessing.
  • If the PR is approved and checks pass, stop unless the user asked for merge or follow-up automation.
  • If review feedback conflicts with the user request, summarize the conflict and ask before making a risky change.

Bundled Scripts

scripts/pr-agent-watch.sh

Wait for PR checks, then wait for review activity and print a review summary when feedback arrives.
Common options:
  • --checks-timeout 30m
  • --checks-interval 10s
  • --review-timeout 2h
  • --review-interval 60s
  • --review-mode any|comments|review|approval|changes-requested
  • --ignore-existing-review
  • --skip-checks
  • --skip-review
Exit codes:
  • 0
    : ready; checks passed and review wait was skipped
  • 10
    : review activity found and summarized
  • 20
    : checks failed or were cancelled
  • 21
    : checks timed out
  • 22
    : review wait timed out
  • 2
    : usage, PR resolution, or GitHub API error

scripts/wait-pr-review.sh

Poll a pull request until matching review activity appears or the timeout expires.
Common options:
  • --timeout 30m
  • --interval 60s
  • --mode any|comments|review|approval|changes-requested
  • --ignore-existing
Exit codes:
  • 0
    : matching review activity found
  • 124
    : timeout
  • 2
    : usage, PR resolution, or GitHub API error

scripts/pr-review-summary.sh

Print PR state, latest reviews, pending review requests, and unresolved review threads with file locations and comment URLs. Use
--json
for parseable output that includes unresolved thread counts, comment URLs, authors, timestamps, and bodies.