Files
greptimedb/.github/workflows/pr-open-limit.yml
dennis zhuang f27f27da66 fix(ci): grant pull-requests write and stop counting drafts (#8844)
Posting to `/issues/{n}/comments` is authorized against the target object, and
that object is a pull request, so `issues: write` alone is refused with 403 and
the warning comment never lands.

Drafts are no longer counted and no longer warned about. `ready_for_review` is
added to the trigger types so that opening as a draft and flipping it to ready
still goes through the check.

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
2026-08-11 07:59:12 +00:00

49 lines
1.3 KiB
YAML

name: PR Open Limit
on:
pull_request_target:
types:
- opened
- reopened
- ready_for_review
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: write
issues: write
jobs:
check-open-limit:
name: Check Open Pull Request Limit
runs-on: ubuntu-latest
timeout-minutes: 10
# Advisory: a script failure must not put a red cross on the pull request.
continue-on-error: true
if: ${{ github.repository == 'GreptimeTeam/greptimedb' }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
working-directory: .github/scripts
run: npm ci
- name: Check open pull request limit
working-directory: .github/scripts
run: node pr-open-limit.js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
PR_IS_DRAFT: ${{ github.event.pull_request.draft }}
MAX_OPEN_PRS: ${{ vars.MAX_OPEN_PRS_PER_AUTHOR || 5 }}