-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: clang_format.yml lints only modified source files (#196)
closes #128
- Loading branch information
Showing
1 changed file
with
23 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|