Godot Engine – Multi-platform 2D and 3D game engine
Fix prek checks sometimes checking zero files or failing with too many
Aaron Franke210621ff97a4
diff --git a/.github/actions/clangd-tidy/action.yml b/.github/actions/clangd-tidy/action.ymlindex a003d586d00..502c75cc406 100644--- a/.github/actions/clangd-tidy/action.yml+++ b/.github/actions/clangd-tidy/action.yml@@ -26,5 +26,14 @@ runs:echo "::endgroup::"echo "::group::Running clangd-tidy"- clangd-tidy ${{ inputs.changed-files }}+ CHANGED_FILES='${{ inputs.changed-files }}'+ CHANGED_FILES_LENGTH=${#CHANGED_FILES}+ if [ "$CHANGED_FILES_LENGTH" -lt 5 ]; then+ echo "No changed files to check."+ elif [ "$CHANGED_FILES_LENGTH" -gt 100000 ]; then+ # Avoid argument length limitations by using xargs to pass the file list.+ printf '%s\n' $CHANGED_FILES | tr -d '"' | xargs clangd-tidy+ else+ clangd-tidy $CHANGED_FILES+ fiecho "::endgroup::"diff --git a/.github/workflows/static_checks.yml b/.github/workflows/static_checks.ymlindex 0f650fa052a..579106a6fbc 100644--- a/.github/workflows/static_checks.yml+++ b/.github/workflows/static_checks.yml@@ -39,7 +39,27 @@ jobs:skip_initial_fetch: truefiles_yaml_from_source_file: .github/changed_files.yml- - name: Style checks via prek+ - name: Decide prek file scope (all files or only changed files)+ id: prek-scope+ shell: bash+ env:+ CHANGED_FILES: '"${{ steps.changed-files.outputs.everything_all_changed_files }}"' # Wrap with quotes to bookend internal quote separators.+ run: |+ CHANGED_FILES_LENGTH=${#CHANGED_FILES}+ if [ "$CHANGED_FILES_LENGTH" -lt 5 ] || [ "$CHANGED_FILES_LENGTH" -gt 100000 ]; then+ echo "use_all_files=true" >> "$GITHUB_OUTPUT"+ else+ echo "use_all_files=false" >> "$GITHUB_OUTPUT"+ fi++ - name: Style checks via prek (all files)+ if: steps.prek-scope.outputs.use_all_files == 'true'+ uses: j178/prek-action@v2+ with:+ extra-args: --all-files++ - name: Style checks via prek (changed files)+ if: steps.prek-scope.outputs.use_all_files == 'false'uses: j178/prek-action@v2env:CHANGED_FILES: '"${{ steps.changed-files.outputs.everything_all_changed_files }}"' # Wrap with quotes to bookend internal quote separators.