From 491a8c6df064d205b259f36518c07bb22d6ead64 Mon Sep 17 00:00:00 2001 From: Luca Burelli Date: Tue, 9 Sep 2025 11:24:10 +0200 Subject: [PATCH 1/2] format-check: rework to test modified files only The Github UI for required checks does not integrate with the workflows described in the .github directory. Currently jobs that are never started due to conditional execution are not even reported, so the UI shows "expected" and locks up merges. Rework the format-check workflow to first list the modified files that need to be checked, and then run the check only on those files. This way the test runs on every pull request, but has minimal impact unless one or more source files are actually modified. Requires a branched version of jidicula/clang-format-action 4.15.0 that adds the 'check-files-from' input parameter. Signed-off-by: Luca Burelli --- .github/workflows/format_check.yml | 55 ++++++++++++------------------ 1 file changed, 22 insertions(+), 33 deletions(-) diff --git a/.github/workflows/format_check.yml b/.github/workflows/format_check.yml index b6417037..ca295961 100644 --- a/.github/workflows/format_check.yml +++ b/.github/workflows/format_check.yml @@ -4,11 +4,6 @@ on: push: branches: - 'main' - paths: - - '**/*.c' - - '**/*.cpp' - - '**/*.h' - - '**/*.hpp' pull_request: types: @@ -18,43 +13,37 @@ on: - synchronize branches: - 'main' - paths: - - '**/*.c' - - '**/*.cpp' - - '**/*.h' - - '**/*.hpp' - - workflow_dispatch: - inputs: - logLevel: - description: 'Log level' - required: true - default: 'warning' jobs: - format-check: + verify-format: runs-on: ubuntu-latest - strategy: - matrix: - path: - - check: 'cores/arduino/' - exclude: 'cores/arduino/api/' - - check: 'loader/' - exclude: 'loader/llext_exports\.c$' - - check: 'libraries/' - exclude: '(examples|extras|ea_malloc)' - fail-fast: false - steps: - name: Checkout code uses: actions/checkout@v4 with: submodules: false persist-credentials: false - + - name: Get changed source files that need format check + id: changed-files + uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46.0.5 + with: + files: | + cores/arduino/**/*.{c,cpp,h,hpp,ino} + loader/**/*.{c,cpp,h,hpp,ino} + libraries/**/*.{c,cpp,h,hpp,ino} + files_ignore: | + cores/arduino/api/** + loader/llext_exports.c + libraries/examples/** + libraries/extras/** + libraries/ea_malloc/** + write_output_files: true + - name: List changed files + if: steps.changed-files.outputs.any_changed == 'true' + run: cat .github/outputs/all_changed_files.txt - name: Run clang-format check - uses: jidicula/clang-format-action@v4.15.0 + if: steps.changed-files.outputs.any_changed == 'true' + uses: pillo79/clang-format-action@05f671e71f0758aba4d3c9dbb0ee81bc5f0137c6 with: clang-format-version: '19' - check-path: ${{ matrix.path['check'] }} - exclude-regex: ${{ matrix.path['exclude'] }} + check-files-from: .github/outputs/all_changed_files.txt From 846dc360c7234b1afd88a04e10fa6718e70c1a72 Mon Sep 17 00:00:00 2001 From: Luca Burelli Date: Tue, 9 Sep 2025 16:38:50 +0200 Subject: [PATCH 2/2] package_core: Fix format check UI Do not set a name for the verify-core job, as this causes the GitHub UI to show a generic name in the required status checks list. --- .github/workflows/package_core.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/package_core.yml b/.github/workflows/package_core.yml index 5a69c882..53347c21 100644 --- a/.github/workflows/package_core.yml +++ b/.github/workflows/package_core.yml @@ -184,7 +184,6 @@ jobs: failOnError: false verify-core: - name: Collect job errors runs-on: ubuntu-latest if: cancelled() || contains(needs.*.result, 'failure') needs: