Skip to content

Let the PR creation cap count draft pull requests - #139

Merged
clambertus merged 1 commit into
apache:mainfrom
potiuk:creation-cap-include-drafts
Oct 9, 2026
Merged

clambertus merged 1 commit into
apache:mainfrom
potiuk:creation-cap-include-drafts

Conversation

@potiuk

@potiuk potiuk commented Oct 9, 2026

Copy link
Copy Markdown
Member

GitHub now lets the pull request creation cap count draft PRs. Before this, a user held to a cap could open any number of drafts. GitHub exposes this as an optional include_drafts boolean on the PATCH /repos/{owner}/{repo}/interaction-limits/pulls/creation-cap endpoint, which pr_creation_cap already calls.

This adds github.pull_requests.creation_cap.include_drafts:

github:
  pull_requests:
    creation_cap:
      enabled: true
      max_open_pull_requests: 5
      include_drafts: true
  • Sent only when the cap is enabled.
  • Omitted → left out of the payload, so a value set by hand in the repository settings is kept.
  • Set in the previous .asf.yaml and dropped now → false is sent, so removing the key reverts it.

README updated; six unit tests added. pytest (165 passed) and pre-commit run --all-files are clean.

Sandbox test against potiuk/infrastructure-asfyaml-sandbox at d537e97, verified by reading the creation-cap endpoint back after each run ({enabled, max_open_pull_requests, include_drafts}):

Row Before After Run
Set (noop) {false,7,false} unchanged run
Set include_drafts: true {false,7,false} {true,3,true} run
Update to false {true,3,true} {true,3,false} run
Key omitted, true set by hand {true,3,true} {true,4,true} run
enabled: false {true,4,true} {false,4,true} run

Not covered in the sandbox: the "key removed after it was set" path, because the previous .asf.yaml cache doesn't exist outside production. Unit tests cover it. The sandbox was reset to baseline afterwards.

🤖 Generated with Claude Code

GitHub's pull request creation cap only counted open, non-draft pull
requests, so a user held to a cap could still open any number of drafts
-- the loophole that automated PR floods use. GitHub now lets the cap
count drafts too, exposed as the `include_drafts` field on the existing
PATCH /repos/{owner}/{repo}/interaction-limits/pulls/creation-cap
endpoint (changelog 2026-10-08).

Add an optional `include_drafts` boolean under
github.pull_requests.creation_cap and send it with the PATCH when the
cap is enabled. When it is omitted it is left out of the payload, so a
value set by hand in the repository settings is not overwritten. When a
previous .asf.yaml set it and the current one drops it, send `false`,
so removing the key reverts the setting instead of leaving it stuck.

Generated-by: Claude Opus 5
@clambertus
clambertus merged commit 83d367d into apache:main Oct 9, 2026
5 checks passed
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.

2 participants