| name: Check File Sizes | |
| on: | |
| pull_request: | |
| push: | |
| branches: ["master"] | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| jobs: | |
| check-file-sizes: | |
| name: Check Git blob sizes (<= 25 MiB) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Run unit tests | |
| run: python3 .github/scripts/check_file_sizes_test.py -v | |
| - name: Check repository blob sizes | |
| env: | |
| PUSH_BEFORE_SHA: ${{ github.event.before }} | |
| run: | | |
| if [[ "${GITHUB_EVENT_NAME}" == "push" && -n "${PUSH_BEFORE_SHA}" && "${PUSH_BEFORE_SHA}" != "0000000000000000000000000000000000000000" ]]; then | |
| python3 .github/scripts/check_file_sizes.py --base-ref "${PUSH_BEFORE_SHA}" | |
| else | |
| python3 .github/scripts/check_file_sizes.py | |
| fi |