Skip to content

PR Lifecycle Automation

Automated pull request management from creation to merge with CI monitoring and review resolution.

Overview

PR Lifecycle Automation handles the complete pull request workflow:

Pre-PR Checks (build, test, lint)

Create PR (gh pr create)

CI Monitoring Loop (max 10 min, 5 retry cycles)

Review Resolution Loop (max 3 cycles)

Merge & Cleanup

Workflow Stages

Stage 1: Pre-PR Checks

Before creating a PR, the workflow verifies:

  • No uncommitted changes
  • Build passes locally
  • Tests pass locally
  • Lint passes locally
  • Branch is pushed to remote

Stage 2: Create PR

Generates a structured PR with:

## Summary
- What this PR does (1-3 bullet points)

## Changes
- List of significant changes

## Test Plan
- [ ] Unit tests pass
- [ ] Integration tests pass
- [ ] Manual testing completed

PR title follows conventional commits format: feat(scope): description

Stage 3: CI Monitoring Loop

┌──────────────────────────────────────────────────┐
│              CI Monitoring Loop                   │
│                                                   │
│  Check CI Status ──▶ All Passing? ──▶ Done       │
│       │                    │                      │
│       │               No (Failed)                 │
│       │                    │                      │
│       │         ┌─────────▼──────────┐            │
│       │         │ Diagnose Failure   │            │
│       │         │ Fix Issue          │            │
│       │         │ Push Fix           │            │
│       │         └─────────┬──────────┘            │
│       │                   │                       │
│       │            Retry < 5?                     │
│       │           ├── Yes → Re-check              │
│       │           └── No  → STOP                  │
│       │                                           │
│       └── Pending? Wait 60s, re-check (max 10m)  │
└──────────────────────────────────────────────────┘

CI Failure Categories:

CategoryAuto-FixExample
Lint errorYesnpm run lint --fix
Type errorFix typesMissing type annotation
Test failureFix codeAssertion mismatch
Build errorFix buildMissing dependency
Flaky testRe-rungh run rerun <id>

Stage 4: Review Resolution Loop

Read all review comments

Categorize (bug/style/suggestion/question)

Fix all issues in single commit

Push and re-request review

Repeat (max 3 cycles)

Comment Priority:

TypePriorityAction
Bug/Logic errorCriticalFix immediately
Style/ConventionMediumApply suggestion
Suggestion/OptionalLowEvaluate and respond
QuestionLowAnswer in comment

Stage 5: Merge & Cleanup

  • Verify all CI checks passing
  • Verify review approved
  • Squash merge and delete branch
  • Switch to main and pull

Timeout Protection

ParameterDefaultDescription
CI wait timeout10 minMax time to wait for CI completion
CI retry cycles5Max fix-and-recheck attempts
Polling interval60sTime between CI status checks
Review cycles3Max rounds of review resolution

Usage

Slash Command

bash
# Default PR lifecycle (squash merge to main)
/jikime:pr-lifecycle

# Custom base branch
/jikime:pr-lifecycle --base develop

# Draft PR
/jikime:pr-lifecycle --draft

# Merge commit instead of squash
/jikime:pr-lifecycle --merge

# Keep branch after merge
/jikime:pr-lifecycle --no-delete-branch

Command Options

OptionDescriptionDefault
--base <branch>Base branch for PRmain
--squashSquash mergetrue
--mergeMerge commitfalse
--no-delete-branchKeep branch after mergefalse
--draftCreate as draft PRfalse

As a Skill

Skill("jikime-workflow-pr-lifecycle")

Released under the MIT License.