diff --git a/.github/scripts/run-clang-format-all.sh b/.github/scripts/run-clang-format-all.sh deleted file mode 100644 index 4fcf8543a..000000000 --- a/.github/scripts/run-clang-format-all.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -formatter="${CLANG_FORMAT_BIN:-clang-format-19}" -mode="${1:-apply}" - -mapfile -d '' -t files < <( - git ls-files -z -- \ - '*.c' '*.cc' '*.cpp' '*.cxx' '*.h' '*.hh' '*.hpp' '*.hxx' '*.inl' -) - -if [[ "${#files[@]}" -eq 0 ]]; then - echo "No tracked C/C++ files found." - exit 0 -fi - -echo "Found ${#files[@]} tracked C/C++ files." -"$formatter" --version - -case "$mode" in - apply) - printf '%s\0' "${files[@]}" | xargs -0 -r -n 100 "$formatter" -i - ;; - check) - printf '%s\0' "${files[@]}" | xargs -0 -r -n 100 "$formatter" --dry-run --Werror - ;; - *) - echo "Unknown mode: $mode" >&2 - exit 1 - ;; -esac \ No newline at end of file diff --git a/.github/workflows/clang-format-all.yml b/.github/workflows/clang-format-all.yml deleted file mode 100644 index 3cb2b65ba..000000000 --- a/.github/workflows/clang-format-all.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: Clang Format All - -on: - workflow_dispatch: - inputs: - commit_changes: - description: Commit formatted changes back to the selected branch - required: true - default: false - type: boolean - -permissions: - contents: write - -jobs: - clang-format-all: - runs-on: ubuntu-24.04 - concurrency: - group: clang-format-all-${{ github.ref }} - cancel-in-progress: true - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - ref: ${{ github.ref }} - - - name: Install clang-format - run: | - sudo apt-get update - sudo apt-get install -y clang-format-19 - - - name: Format tracked C/C++ files - env: - CLANG_FORMAT_BIN: clang-format-19 - run: | - bash ./.github/scripts/run-clang-format-all.sh apply - - - name: Export patch - id: patch - run: | - if git diff --quiet; then - echo "changed=false" >> "$GITHUB_OUTPUT" - exit 0 - fi - - git diff --binary > clang-format-all.patch - echo "changed=true" >> "$GITHUB_OUTPUT" - - - name: Upload patch artifact - if: steps.patch.outputs.changed == 'true' - uses: actions/upload-artifact@v4 - with: - name: clang-format-all-${{ github.sha }} - path: clang-format-all.patch - retention-days: 7 - - - name: Commit formatted changes - if: steps.patch.outputs.changed == 'true' && github.event.inputs.commit_changes == 'true' - run: | - git config user.name "github-actions[bot]" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - git add -A - git commit -m "Run clang-format over tracked sources" - git push origin HEAD:${GITHUB_REF_NAME} - - - name: Report no-op run - if: steps.patch.outputs.changed == 'false' - run: echo "clang-format produced no changes." \ No newline at end of file