litellm/.github/workflows/oss-pr-file-cap.yml
ryan-crabbe-berri 42f3afc262
ci: cap outside contributor PRs at 20 changed files (#56165)
* ci: cap outside contributor PRs at 20 changed files

Fails a check on fork PRs from people who are not org members or collaborators when the PR changes
more than 20 files. A maintainer can let one through with the allow-large-pr label.

* ci: run the file cap from main's copy and recheck when a PR is retargeted

The check now reads its script from the base commit, so an outside PR cannot replace it, and reruns
on the edited event, which fires when a PR's target branch changes. Tests call the script in-process.

* ci: read the file cap script from the tip of the base branch

---------

Co-authored-by: mateo <277851410+mateo-berri@users.noreply.github.com>
2026-12-04 03:08:13 +00:00

27 lines
758 B
YAML

name: OSS PR file cap
on:
pull_request:
types: [opened, synchronize, reopened, edited, labeled, unlabeled]
permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
file-cap:
name: oss-pr-file-cap
runs-on: ubuntu-latest
timeout-minutes: 3
permissions:
contents: read
steps:
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
with:
ref: ${{ github.event.pull_request.base.ref }}
persist-credentials: false
sparse-checkout: .github/scripts/ci
- name: Fail outside contributor PRs that change more than 20 files
run: python3 .github/scripts/ci/check_pr_file_cap.py