forked from doodlum/skyrim-community-shaders
-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (62 loc) · 2.13 KB
/
clang_format.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Run clang-format Linter
on:
push:
branches:
- main
- dev
- rjwignar/issue-128-test
pull_request_target:
branches:
- main
- dev
workflow_dispatch:
jobs:
format:
runs-on: ubuntu-latest
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write
steps:
- uses: actions/checkout@v3
with:
# check out HEAD on the branch
ref: ${{ github.head_ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
# 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/changed-files@v42.0.5
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
- name: Format changed files
if: steps.changed-files.outputs.any_changed == 'true'
uses: DoozyX/clang-format-lint-action@v0.17
with:
source: "${{ steps.process-list.outputs.changed_files }}"
exclude: "extern include"
extensions: "h,cpp,c,hlsl,hlsli"
clangFormatVersion: 16
inplace: True # commit the changes (if there are any)
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "style: 🎨 apply clang-format changes"
branch: ${{ github.head_ref }}