diff --git a/.github/workflows/repo_check.yml b/.github/workflows/repo_check.yml index fff655061759f..cdd8e31071b34 100644 --- a/.github/workflows/repo_check.yml +++ b/.github/workflows/repo_check.yml @@ -31,31 +31,8 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Check sizes of new Git objects - env: - # 1 MB ought to be enough for anybody. + - uses: james-callahan/gha-prevent-big-files@5bff33da9b9970f671495034b0f7255619b1b8e0 + with: + # 1 MB in bytes. 1 MB ought to be enough for anybody. # TODO in case we may want to consciously commit a bigger file to the repo we may disable the check e.g. with a label - MAX_FILE_SIZE_BYTES: 1048576 - shell: bash - run: | - git rev-list --objects ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} \ - > new-pr-objects.txt - exit_code=0 - while read -r id name; do - size="$(git cat-file -s "${id}")" - if [ "${size}" -gt "${MAX_FILE_SIZE_BYTES}" ]; then - exit_code=1 - if [ -z "${name}" ]; then - name="$(git cat-file -t "${id}") ${id}" - fi - echo "Object ${id} [${name}] has size ${size}, exceeding ${MAX_FILE_SIZE_BYTES} limit." >&2 - echo "::error::File ${name} has size ${size}, exceeding ${MAX_FILE_SIZE_BYTES} limit." - echo "::error file=${name}::This file has size ${size}, exceeding ${MAX_FILE_SIZE_BYTES} limit." - fi - done < new-pr-objects.txt - exit "${exit_code}" -# - uses: james-callahan/gha-prevent-big-files@5bff33da9b9970f671495034b0f7255619b1b8e0 -# with: -# # 1 MB in bytes. 1 MB ought to be enough for anybody. -# # TODO in case we may want to consciously commit a bigger file to the repo we may disable the check e.g. with a label -# max-size: 1048576 + max-size: 1048576