Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/repo-sanity-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ jobs:
run: echo "size=$(du -sb .git/objects/pack | cut -f1)" >> $GITHUB_OUTPUT

- name: Calculate and report delta
env:
HAS_BIG_CHANGES_LABEL: ${{ contains(github.event.pull_request.labels.*.name, 'big changes') }}
run: |
delta=$(( ${{ steps.size_after.outputs.size }} - ${{ steps.size_before.outputs.size }} ))
delta_kb=$(( delta / 1024 ))
Expand All @@ -67,6 +69,16 @@ jobs:
echo "Size after: ${{ steps.size_after.outputs.size }} bytes" >> $GITHUB_STEP_SUMMARY
echo "Repository size would increase by approximately $delta_kb KiB if this PR is squash merged." >> $GITHUB_STEP_SUMMARY

MAX_THR_KB=1024
if [ "$delta_kb" -gt "$MAX_THR_KB" ]; then
if [ "$HAS_BIG_CHANGES_LABEL" = "true" ]; then
echo "Size increase is over threshold ($MAX_THR_KB KiB), but PR has 'big changes' label. Proceeding." >> $GITHUB_STEP_SUMMARY
else
echo "::error::Repository size increase ($delta_kb KiB) exceeds threshold of $MAX_THR_KB KiB. Please use Git LFS for large files or add the 'big changes' label to this PR if the size increase is expected."
exit 1
fi
fi

check-for-binary-files:
runs-on: ubuntu-latest
steps:
Expand Down
Loading