From 71e2aa60ce20e3ef78cdc1dd01d951e0ea3347be Mon Sep 17 00:00:00 2001 From: wins1ey Date: Sun, 2 Jun 2024 22:11:02 +0100 Subject: [PATCH] Created format.yml workflow --- .github/workflows/format.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/format.yml diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 0000000..27296db --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,23 @@ +on: [pull_request] + +jobs: + format-check: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Format files + run: | + clang-format -i $(find src -name '*.c' -or -name '*.h') + + - name: Check for changes + run: | + changed_files=$(git diff --name-only) + if [ -n "$changed_files" ]; then + echo "The following files require formatting:" + echo "$changed_files" + echo "Run 'make format' and commit the changes." + exit 1 + fi