Skip to content

Commit

Permalink
ci: clang_format.yml lints only modified source files (#196)
Browse files Browse the repository at this point in the history
closes #128
  • Loading branch information
rjwignar authored Jul 4, 2024
1 parent 53e7456 commit 28f58d7
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions .github/workflows/clang_format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,31 @@ jobs:
# make sure the parent commit is grabbed as well, because
# that's what will get formatted (i.e. the most recent commit)
fetch-depth: 2
# retrieve comma-separated list of modified files
- name: Retrieve changed files
id: changed-files
uses: tj-actions/[email protected]
with:
files: |
src/**/*.{cpp,h}
include/**/*.{h,hpp}
**/*.hlsl
**/*.hlsli
separator: ","
# process modified files list before passing to clang-format-lint-action
- name: Process changed files list
id: process-list
run: |
CHANGED_FILES="${{ steps.changed-files.outputs.all_changed_files }}"
CHANGED_FILES="${CHANGED_FILES// /\\ }"
CHANGED_FILES=$(echo "$CHANGED_FILES" | tr ',' ' ')
echo "::set-output name=changed_files::${CHANGED_FILES}"
# format the latest commit
- uses: DoozyX/[email protected]
- name: Format changed files
if: steps.changed-files.outputs.any_changed == 'true'
uses: DoozyX/[email protected]
with:
source: "."
source: "${{ steps.process-list.outputs.changed_files }}"
exclude: "extern include"
extensions: "h,cpp,c,hlsl,hlsli"
clangFormatVersion: 16
Expand Down

0 comments on commit 28f58d7

Please sign in to comment.