OverviewFilesCommitsIssuesDocsReleasesPeers

nvidia-rtx-godot / .github / workflows / static_checks.yml

48 lines · yaml ref:
name: 📊 Static Checks
on:
  workflow_call:
    outputs:
      changed-files:
        description: A list of changed files, pre-filtered for parsing by clangd-tidy.
        value: ${{ jobs.static-checks.outputs.changed-files }}
      sources-changed:
        description: Determines if any source files were changed.
        value: ${{ jobs.static-checks.outputs.sources-changed }}
  workflow_dispatch:

jobs:
  static-checks:
    name: Code style, file formatting, and docs
    runs-on: ubuntu-24.04
    timeout-minutes: 30
    outputs:
      changed-files: '"${{ steps.changed-files.outputs.clangd_all_changed_files }}"' # Wrap with quotes to bookend internal quote separators.
      sources-changed: ${{ steps.changed-files.outputs.sources_any_changed }}
    steps:
      - name: Checkout
        uses: actions/checkout@v6
        with:
          fetch-depth: 0 # Treeless clone. Slightly less performant than a shallow clone, but makes finding diffs instantaneous.
          filter: tree:0 # See: https://github.blog/open-source/git/get-up-to-speed-with-partial-clone-and-shallow-clone/

      # This needs to happen before Python and npm execution; it must happen before any extra files are written.
      - name: .gitignore checks (gitignore_check.sh)
        run: |
          bash ./misc/scripts/gitignore_check.sh

      - name: Get changed files
        id: changed-files
        uses: ./.github/actions/changed-files
        with:
          safe_output: false # Output passed to environment variable to avoid command injection.
          separator: '" "' # To account for paths with spaces, ensure our items are split by quotes internally.
          skip_initial_fetch: true
          files_yaml_from_source_file: .github/changed_files.yml

      - name: Style checks via prek
        uses: j178/prek-action@v2
        env:
          CHANGED_FILES: '"${{ steps.changed-files.outputs.everything_all_changed_files }}"' # Wrap with quotes to bookend internal quote separators.
        with:
          extra-args: --files ${{ env.CHANGED_FILES }}