name: draft-limit
# Closes a draft pull request when its author already has another open draft,
# so an outside contributor can't leave a pile of drafts to triage. Maintainers
# and bots are exempt. See jdx/workflows for the workflow implementation.
on:
# Fork pull requests only get a write token under pull_request_target, which
# the shared workflow needs to comment and close. It never checks out or runs
# the pull request's code.
pull_request_target:
types:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
jobs:
draft-limit:
permissions:
pull-requests: write # comment on and close the extra draft
uses: jdx/workflows/.github/workflows/draft-limit.yml@5583759b56aa6c1bee8a35b2597c1b8ccf3626a4 # v1.0.0
with:
max_drafts: 1