Compare commits

...

4 Commits

Author SHA1 Message Date
Greyson LaLonde
4068fa3cfd ci: diff explicit base...head shas to match files-changed 2026-06-17 17:04:16 -07:00
Greyson LaLonde
474496f928 Merge branch 'main' into ci/python-pr-size-gate 2026-06-17 17:01:11 -07:00
Greyson LaLonde
c2d28b932a ci: scope job permissions and use immutable base sha 2026-06-17 16:53:02 -07:00
Greyson LaLonde
3fcbc38280 ci: fail PRs over 1500 lines of python changes 2026-06-17 16:46:36 -07:00

View File

@@ -29,4 +29,30 @@ jobs:
lib/crewai/src/crewai/cli/templates/**
**/*.json
**/test_durations/**
**/cassettes/**
**/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