Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

CI: Pass GitHub Action prek diffs via `--from-ref`

Thaddeus Crews953f28a79743
diff --git a/.github/changed_files.yml b/.github/changed_files.yml
index e1c9337343f..329b4c30b13 100644
--- a/.github/changed_files.yml
+++ b/.github/changed_files.yml
@@ -1,8 +1,3 @@
-# We lack a convenient means of gathering *all* the changes when specializations are passed, so
-# a catch-all variable is the easiest workaround.
-everything:
- - "**"
-
# Determines if build actions should occur after static checks are ran. Broadly speaking, these
# files changing would result in SCons rebuilding the engine, or are otherwise pertinent to the
# buildsystem itself.
diff --git a/.github/workflows/static_checks.yml b/.github/workflows/static_checks.yml
index 579106a6fbc..0c6c907b0fc 100644
--- a/.github/workflows/static_checks.yml
+++ b/.github/workflows/static_checks.yml
@@ -39,29 +39,12 @@ jobs:
skip_initial_fetch: true
files_yaml_from_source_file: .github/changed_files.yml
- - name: Decide prek file scope (all files or only changed files)
- id: prek-scope
- shell: bash
+ - name: Style checks via prek
+ uses: j178/[email protected]
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@v2
- env:
- CHANGED_FILES: '"${{ steps.changed-files.outputs.everything_all_changed_files }}"' # Wrap with quotes to bookend internal quote separators.
+ FROM_REF: >-
+ ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha
+ || github.event.before != '0000000000000000000000000000000000000000' && github.event.before
+ || 'HEAD~1' }}
with:
- extra-args: --files ${{ env.CHANGED_FILES }}
+ extra-args: --from-ref ${{ env.FROM_REF }}