mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-08-21 13:38:44 +00:00
f27f27da66
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>
49 lines
1.3 KiB
YAML
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 }}
|