diff --git a/.github/workflows/check_file_size.yml b/.github/workflows/check_file_size.yml index fef0bb3494..d9d60c4e48 100644 --- a/.github/workflows/check_file_size.yml +++ b/.github/workflows/check_file_size.yml @@ -1,4 +1,4 @@ -name: Check Pull Request File Size +name: Check Pull Request File Size and Print Size Changes on: pull_request: @@ -22,16 +22,26 @@ jobs: - name: Get Changed Files id: get_changed_files run: | - echo "::set-output name=changed_files::$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }})" + echo "changed_files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }})" >> $GITHUB_ENV shell: bash - - name: Check File Size - id: check_size + - name: Check File Size Changes and Fail if Exceeds 2MB + id: check_size_changes run: | - for file in ${{ steps.get_changed_files.outputs.changed_files }}; do - file_size=$(stat -c %s "$file") - if [ $file_size -gt 2000000 ]; then - echo "File $file exceeds the 2MB limit with a size of $(($file_size / 1000000)) MB" + for file in $changed_files; do + old_size=$(stat -c %s "$file") + git checkout ${{ github.event.before }} -- "$file" + new_size=$(stat -c %s "$file") + size_change=$(($new_size - $old_size)) + size_change_in_mb=$(($size_change / 1000000)) + + echo "File: $file" + echo "Old Size: $(($old_size / 1000000)) MB" + echo "New Size: $(($new_size / 1000000)) MB" + echo "Size Change: $size_change_in_mb MB" + + if [ $size_change_in_mb -gt 2 ]; then + echo "Size change exceeds 2MB limit. Failing the workflow." exit 1 fi done diff --git a/.github/workflows/docs-build.yml b/.github/workflows/docs-build.yml index 79f448086b..801c75c699 100644 --- a/.github/workflows/docs-build.yml +++ b/.github/workflows/docs-build.yml @@ -55,7 +55,7 @@ jobs: - name: Install GDAL run: | conda install -c conda-forge mamba --yes - mamba install -c conda-forge gdal pyproj --yes + mamba install -c conda-forge gdal=3.6.4 pyproj --yes - name: Test GDAL installation run: | diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 2e124f1378..a63f44dd53 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -53,7 +53,7 @@ jobs: - name: Install GDAL run: | conda install -c conda-forge mamba --yes - mamba install -c conda-forge gdal pyproj --yes + mamba install -c conda-forge gdal=3.6.4 pyproj --yes - name: Test GDAL installation run: | diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 790ee3e494..d6f5541dfc 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -58,7 +58,7 @@ jobs: - name: Install GDAL run: | conda install -c conda-forge mamba --yes - mamba install -c conda-forge gdal pyproj --yes + mamba install -c conda-forge gdal=3.6.4 pyproj --yes - name: Test GDAL installation run: |