mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-04-23 14:33:36 +00:00
chore: remove the autocommit action
dont want this, should be check only Co-Authored-By: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com>
This commit is contained in:
parent
c45a7b473f
commit
6388de266a
32
.github/scripts/run-clang-format-all.sh
vendored
32
.github/scripts/run-clang-format-all.sh
vendored
|
|
@ -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
|
||||
69
.github/workflows/clang-format-all.yml
vendored
69
.github/workflows/clang-format-all.yml
vendored
|
|
@ -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."
|
||||
Loading…
Reference in a new issue