Skip to content

Add draft PR cleanup automation policy #12168

@github-actions

Description

@github-actions

Problem

Analysis of recent PR activity (Jan 24-28) shows 25 draft PRs (9.6% of total 260 PRs) remain open, with some potentially abandoned work-in-progress items. This creates clutter in the PR list and makes triage more difficult.

Proposed Solution

Implement automated cleanup policy for stale draft PRs:

  1. Warning phase (10 days of inactivity):

    • Post comment: "This draft PR has been inactive for 10 days and will be auto-closed in 4 days unless updated"
    • Label: stale-draft
  2. Cleanup phase (14 days of inactivity):

    • Auto-close with comment: "Closing inactive draft PR. Feel free to reopen if work continues."
    • Keep stale-draft label for tracking
  3. Exemptions:

    • PRs with keep-draft label
    • PRs marked as blocked or awaiting-review
    • PRs with activity in last 10 days

Implementation

Create workflow: .github/workflows/draft-pr-cleanup.md

---
engine: copilot
on:
  schedule:
    - cron: '0 2 * * *'  # Daily at 2 AM UTC
safe-outputs:
  max:
    issues: 0
    pull_requests: 0
    comments: 20  # Up to 20 stale draft warnings/closes per run
---

Review all open draft PRs and:
1. Identify drafts with >10 days of inactivity (no commits, comments, or label changes)
2. For drafts inactive 10-13 days: Add warning comment and `stale-draft` label
3. For drafts inactive >14 days: Close with cleanup comment (unless exempted)
4. Exempt PRs with `keep-draft`, `blocked`, or `awaiting-review` labels

Use GitHub MCP tools to query drafts, check activity, and post comments.

Success Metrics

  • Draft PR rate drops from 9.6% to <5%
  • Faster PR triage (less clutter)
  • Clear communication to PR authors
  • Exemption system prevents premature closure

Context

  • Current draft PRs: 25 (out of 260 recent PRs)
  • Estimated abandoned drafts: 10-15
  • Impact on ecosystem: Minor but improves maintainability
  • Priority: P2 (this week)

Related

Agent Performance Report - Week of January 24-28, 2026

AI generated by Agent Performance Analyzer - Meta-Orchestrator

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions