mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-07-03 14:09:24 +00:00
58 lines
1.9 KiB
YAML
58 lines
1.9 KiB
YAML
name: PR Size Check
|
|
|
|
on:
|
|
pull_request:
|
|
types: [opened, synchronize, reopened]
|
|
|
|
jobs:
|
|
pr-size:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
pull-requests: write
|
|
steps:
|
|
- uses: codelytv/pr-size-labeler@095a41fca88b8764fd9e008ad269bcdb82bb38b9 # v1
|
|
with:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
xs_label: "size/XS"
|
|
xs_max_size: 25
|
|
s_label: "size/S"
|
|
s_max_size: 100
|
|
m_label: "size/M"
|
|
m_max_size: 250
|
|
l_label: "size/L"
|
|
l_max_size: 500
|
|
xl_label: "size/XL"
|
|
fail_if_xl: false
|
|
files_to_ignore: |
|
|
uv.lock
|
|
*.lock
|
|
lib/crewai/src/crewai/cli/templates/**
|
|
**/*.json
|
|
**/test_durations/**
|
|
**/cassettes/**
|
|
|
|
python-diff-size:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
steps:
|
|
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Enforce Python diff size limit
|
|
env:
|
|
MAX: "1500"
|
|
BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
|
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
|
run: |
|
|
# Three-dot base...head == merge-base(base, head)..head: matches GitHub's
|
|
# "Files changed" diff and ignores the synthetic merge commit at HEAD.
|
|
# Sum added + deleted lines across changed .py files; skip binaries ("-").
|
|
total=$(git diff --numstat "$BASE_SHA...$HEAD_SHA" -- '*.py' \
|
|
| awk '$1 != "-" && $2 != "-" { sum += $1 + $2 } END { print sum + 0 }')
|
|
echo "Python churn: $total lines (limit $MAX)"
|
|
if [ "$total" -gt "$MAX" ]; then
|
|
echo "::error::Python changes total $total lines, over the $MAX-line limit. Split into smaller PRs."
|
|
git diff --numstat "$BASE_SHA...$HEAD_SHA" -- '*.py' | sort -rn
|
|
exit 1
|
|
fi |