GitHub/Workflows: Add an action to check C++ source file format
authorWook Song <wook16.song@samsung.com>
Tue, 23 Jan 2024 05:10:24 +0000 (14:10 +0900)
committerwooksong <wook16.song@samsung.com>
Tue, 23 Jan 2024 10:04:17 +0000 (19:04 +0900)
This patch adds a GitHub Action workflow to check C++ source file
format.

Signed-off-by: Wook Song <wook16.song@samsung.com>
.github/workflows/cpp-linter.yml [new file with mode: 0644]

diff --git a/.github/workflows/cpp-linter.yml b/.github/workflows/cpp-linter.yml
new file mode 100644 (file)
index 0000000..4196483
--- /dev/null
@@ -0,0 +1,25 @@
+name: c++-source-file-format-checker
+
+on: pull_request
+
+jobs:
+  cpp-linter:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v4
+      - uses: cpp-linter/cpp-linter-action@v2
+        id: linter
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+        with:
+          style: file
+          extensions: 'cc'
+          version: 16
+          lines-changed-only: true
+
+
+      - name: failing fast
+        if: steps.linter.outputs.clang-format-checks-failed > 0
+        run: |
+          echo "This PR failed to pass the C++ source file format checks."
+          exit 1