CI: Add changed-files GitHub Action
#67810
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: 📊 Static Checks | ||
|
Check failure on line 1 in .github/workflows/static_checks.yml
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| event-name: | ||
| description: The caller's `github.event_name` value. | ||
| type: string | ||
| required: true | ||
| jobs: | ||
| static-checks: | ||
| name: Code style, file formatting, and docs | ||
| runs-on: ubuntu-24.04 | ||
| timeout-minutes: 30 | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 2 | ||
| # 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 branch name | ||
| id: branch-name | ||
| uses: tj-actions/branch-names@v9 | ||
| - name: Get last successful commit | ||
| id: last-successful-commit | ||
| uses: nrwl/nx-set-shas@v4 | ||
| with: | ||
| main-branch-name: ${{ inputs.event-name == "pull" && steps.branch-name.outputs.current_branch || steps.branch-name.outputs.base_ref_branch }} | ||
| - name: Get changed files | ||
| id: changed-files | ||
| uses: tj-actions/changed-files@v47 | ||
| with: | ||
| base_sha: ${{ steps.last-successful-commit.outputs.base }} # Compare against last successful commit. | ||
| separator: '" "' # To account for paths with spaces, ensure our items are split by quotes internally. | ||
| safe_output: false # Output passed to environment variable to avoid command injection. | ||
| - name: Style checks via pre-commit | ||
| uses: pre-commit/action@v3.0.1 | ||
| env: | ||
| CHANGED_FILES: '"${{ steps.changed-files.outputs.all_changed_files }}"' # Wrap with quotes to bookend internal quote separators. | ||
| with: | ||
| extra_args: --files ${{ env.CHANGED_FILES }} | ||
| - name: Class reference schema checks | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install libxml2-utils | ||
| xmllint --quiet --noout --schema doc/class.xsd doc/classes/*.xml modules/*/doc_classes/*.xml platform/*/doc_classes/*.xml | ||
| - name: Run C compiler on `gdextension_interface.h` | ||
| run: | | ||
| gcc -c core/extension/gdextension_interface.h | ||