[CI] Align metric units for CI rate limit (#13633)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
gemini-code-assist[bot]
parent
b51f9bbee7
commit
19729f723e
@@ -5,10 +5,10 @@ on:
|
|||||||
description: "Whether the PR must have the run-ci label"
|
description: "Whether the PR must have the run-ci label"
|
||||||
type: boolean
|
type: boolean
|
||||||
default: true
|
default: true
|
||||||
rate-limit-hours:
|
cool-down-minutes:
|
||||||
description: "Rate limit window size in hours; 0 disables rate limiting"
|
description: "Cooldown period in minutes for low-permission users; 0 disables rate limiting"
|
||||||
type: number
|
type: number
|
||||||
default: 2
|
default: 120
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
pr-gate:
|
pr-gate:
|
||||||
@@ -41,7 +41,7 @@ jobs:
|
|||||||
echo "PR Draft: ${{ steps.pr.outputs.draft }}"
|
echo "PR Draft: ${{ steps.pr.outputs.draft }}"
|
||||||
echo "PR User: ${{ steps.pr.outputs.user }}"
|
echo "PR User: ${{ steps.pr.outputs.user }}"
|
||||||
echo "Require run-ci: ${{ inputs.require-run-ci }}"
|
echo "Require run-ci: ${{ inputs.require-run-ci }}"
|
||||||
echo "Rate limit hours: ${{ inputs.rate-limit-hours }}"
|
echo "Cool down minutes: ${{ inputs.cool-down-minutes }}"
|
||||||
echo "==================="
|
echo "==================="
|
||||||
|
|
||||||
- name: Block draft PR
|
- name: Block draft PR
|
||||||
@@ -60,12 +60,12 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Enforce rate limit for low-permission actors (optional)
|
- name: Enforce rate limit for low-permission actors (optional)
|
||||||
if: github.event_name == 'pull_request' && inputs.rate-limit-hours > 0
|
if: github.event_name == 'pull_request' && inputs.cool-down-minutes > 0
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@v7
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
script: |
|
script: |
|
||||||
const DEFAULT_HOURS = Number("${{ inputs.rate-limit-hours }}");
|
const DEFAULT_MINUTES = Number("${{ inputs.cool-down-minutes }}");
|
||||||
const owner = context.repo.owner;
|
const owner = context.repo.owner;
|
||||||
const repo = context.repo.repo;
|
const repo = context.repo.repo;
|
||||||
const eventName = context.eventName;
|
const eventName = context.eventName;
|
||||||
@@ -96,7 +96,7 @@ jobs:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let effectiveCooldownMinutes = DEFAULT_HOURS * 60;
|
let effectiveCooldownMinutes = DEFAULT_MINUTES;
|
||||||
let perUserCooldownMinutes = null;
|
let perUserCooldownMinutes = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -89,13 +89,13 @@ If you don’t have permission, please ask maintainers to trigger CI for you.
|
|||||||
|
|
||||||
We apply CI rate limits to prevent abuse and ensure fair usage of our CI resources.
|
We apply CI rate limits to prevent abuse and ensure fair usage of our CI resources.
|
||||||
|
|
||||||
Each CI workflow has a default limit defined in its workflow configuration file. For example, in [pr-gate.yml](https://github.com/sgl-project/sglang/blob/main/.github/workflows/pr-gate.yml), the default rate limit window is 2 hours, and each workflow can override it via the `rate-limit-hours` input parameter:
|
Each CI workflow has a default limit defined in its workflow configuration file. For example, in [pr-gate.yml](https://github.com/sgl-project/sglang/blob/main/.github/workflows/pr-gate.yml), the default cooldown period is 120 minutes, and each workflow can override it via the `cool-down-minutes` input parameter:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
rate-limit-hours:
|
cool-down-minutes:
|
||||||
description: "Rate limit window size in hours; 0 disables rate limiting"
|
description: "Default cooldown period in minutes; 0 disables rate limiting"
|
||||||
type: number
|
type: number
|
||||||
default: 2
|
default: 120
|
||||||
```
|
```
|
||||||
|
|
||||||
Users listed in [CI_PERMISSIONS.json](https://github.com/sgl-project/sglang/blob/main/.github/CI_PERMISSIONS.json) may have a per-user cooldown interval. In practice, we use the minimum of the workflow’s default window and the user-specific interval.
|
Users listed in [CI_PERMISSIONS.json](https://github.com/sgl-project/sglang/blob/main/.github/CI_PERMISSIONS.json) may have a per-user cooldown interval. In practice, we use the minimum of the workflow’s default window and the user-specific interval.
|
||||||
|
|||||||
Reference in New Issue
Block a user