Skip to content

ci: limit each contributor to one open draft PR - #1519

Merged
jdx merged 1 commit into
mainfrom
ci/draft-limit
Sep 29, 2026
Merged

jdx merged 1 commit into
mainfrom
ci/draft-limit

Conversation

@jdx

@jdx jdx commented Sep 29, 2026 •

Copy link
Copy Markdown
Owner

https://entire.io/gh/jdx/usage/trails/65

Stops an outside contributor from leaving several draft pull requests open at once. GitHub has no setting that caps a contributor's open PRs, so this adds a small workflow that enforces it.

When a draft PR is opened, reopened, or converted back to a draft, the workflow counts the author's other open drafts. If they already have one, it closes the new draft with a comment:

Thanks for the contribution! To keep review manageable, this repository allows each contributor 1 open draft pull request(s) at a time, and you already have #123.

Please finish it (mark it ready for review) or close it, then reopen this pull request.

  • Owners, members, and collaborators are exempt, and so are bots (Renovate, etc.), so this only affects outside contributors.
  • When two drafts are opened at the same moment, only the newer one is closed.
  • Ready-for-review PRs are never counted or closed.
  • The limit is max_drafts (default 1) in the caller.

The logic lives in the shared jdx/workflows repo and is pinned to v1.0.0, so Renovate will keep it current. The trigger is pull_request_target because fork PRs only get a write token there; the workflow never checks out or runs the PR's code, and the zizmor: ignore[dangerous-triggers] in the file records that.

Validation: actionlint and zizmor (including the online audits) pass, and the decision logic was exercised against a stubbed gh for the open/reopen/convert/exempt/race cases. It has not yet run against a real outside contributor's PR.

AI-assisted — Tool: Claude Code; model: anthropic/claude-sonnet-5-5; version: 2.1.284.

🤖 Generated with Claude Code


Note

Medium Risk
Uses pull_request_target, which is sensitive, but scope is limited to commenting/closing draft PRs via a pinned reusable workflow without checking out fork code.

Overview
Adds a new GitHub Actions workflow draft-limit that caps each outside contributor to one open draft PR at a time.

On opened, reopened, or converted_to_draft, it delegates to the pinned shared workflow jdx/workflows (v1.0.0) with max_drafts: 1. If the author already has another open draft, the workflow comments and closes the newer draft; ready-for-review PRs are not affected. The job uses pull_request_target (with a zizmor ignore) so fork PRs get pull-requests: write for comment/close only—the caller does not check out or run PR code. Repo members and bots are handled in the shared implementation.

Reviewed by Cursor Bugbot for commit 0d7016c. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • Chores
    • Added an automated limit of one draft pull request per contributor.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Advanced

Run ID: 3027dc5d-2ecf-4674-9d6c-81e594482edc

📥 Commits

Reviewing files that changed from the base of the PR and between 0a1b004 and 0d7016c.

📒 Files selected for processing (1)
  • .github/workflows/draft-limit.yml

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

Adds a GitHub Actions workflow that calls a pinned reusable workflow when a pull request is opened, reopened, or converted to draft. The job grants pull request write permission and sets the maximum draft count to one.

Changes

Draft Limit

Layer / File(s) Summary
Trigger and reusable workflow call
.github/workflows/draft-limit.yml
The workflow handles opened, reopened, and converted-to-draft events. It calls the pinned reusable workflow with max_drafts set to 1 and grants pull-requests: write permission.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Merge Risk: ⚪ Minimal · up to 0d701

The workflow applies the one-draft limit without running contributor code with its write token. No actionable merge-blocking risk is established.

Architecture Summary

Architecture risk: 🔵 Low · up to 0d701

The changed surface does not map to a changed system, dependency edge, entrypoint, or external dependency.

Changed systems: None identified.

Architecture concerns
No architecture-level concerns identified.

Review details

Before / after behavior

  • observed — Modified behavior in .github/workflows/draft-limit.yml: Adds the draft-limit workflow, triggered by pull_request_target for opened, reopened, and converted-to-draft events. The job calls jdx/workflows at a pinned revision, grants pull-requests: write, and passes max_drafts: 1.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: limiting each contributor to one open draft pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Adds a workflow to auto-close duplicate draft pull requests.

The PR appears safe to merge based on the changed caller workflow.

Summary

Adds a workflow that invokes a pinned shared workflow to limit outside contributors to one open draft PR. It runs when a PR is opened, reopened, or converted to a draft, and grants the called job permission to comment on and close PRs.

Reviews (1) · Last reviewed commit: "ci: limit each contributor to one open d..."

@jdx
jdx merged commit d57749c into main Sep 29, 2026
12 of 13 checks passed
@jdx
jdx deleted the ci/draft-limit branch September 29, 2026 22:22
mise-en-dev added a commit that referenced this pull request Oct 6, 2026
<!-- entire-trail-link-start -->
https://entire.io/gh/jdx/usage/trails/58
<!-- entire-trail-link-end -->

### ⚡ Performance

- reduce development debug info by [@jdx](https://github.com/jdx) in
[#1525](#1525)

### 🧪 Testing

- **(lib)** support independently enabled optional features by
[@jdx](https://github.com/jdx) in
[#1513](#1513)

### 🛡️ Security

- restrict AI replies on Discussions and Issues and note the instant ban
by [@jdx](https://github.com/jdx) in
[#1522](#1522)

### 🔍 Other Changes

- **(entire)** store checkpoints in a private repository by
[@jdx](https://github.com/jdx) in
[190ff3e](190ff3e)
- **(entire)** commit codex session hooks by
[@jdx](https://github.com/jdx) in
[abee1b8](abee1b8)
- **(entire)** commit claude session hooks by
[@jdx](https://github.com/jdx) in
[364d74e](364d74e)
- **(entire)** restore lower-cost trail findings by
[@jdx](https://github.com/jdx) in
[2f2f991](2f2f991)
- limit each contributor to one open draft PR by
[@jdx](https://github.com/jdx) in
[#1519](#1519)
- add hk pre-commit hook by [@jdx](https://github.com/jdx) in
[#1523](#1523)
- update pr-closer policy by [@jdx](https://github.com/jdx) in
[a2608b7](a2608b7)

### 📦️ Dependency Updates

- update ubuntu:26.04 docker digest to da6fc2b by
[@renovate[bot]](https://github.com/renovate[bot]) in
[#1514](#1514)
- update jdx/renovate-config action to v1.0.1 by
[@renovate[bot]](https://github.com/renovate[bot]) in
[#1515](#1515)
- update mise tools to latest by
[@renovate[bot]](https://github.com/renovate[bot]) in
[#1516](#1516)
- update dependency communique to latest by
[@renovate[bot]](https://github.com/renovate[bot]) in
[#1518](#1518)
- update dependency aube to latest by
[@renovate[bot]](https://github.com/renovate[bot]) in
[#1520](#1520)
- run go mod tidy on Renovate branches by [@jdx](https://github.com/jdx)
in [#1521](#1521)
- update module github.com/urfave/cli/v3 to v3.13.0 by
[@renovate[bot]](https://github.com/renovate[bot]) in
[#1517](#1517)
- lock file maintenance by
[@renovate[bot]](https://github.com/renovate[bot]) in
[#1524](#1524)
- update dependency golangci-lint to v2.14.0 by
[@renovate[bot]](https://github.com/renovate[bot]) in
[#1526](#1526)
- update jdx/mise-action action to v5 by
[@renovate[bot]](https://github.com/renovate[bot]) in
[#1527](#1527)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant