forked from organicmaps/organicmaps
-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (40 loc) · 1.25 KB
/
Copy pathcpp-code-check.yaml
File metadata and controls
45 lines (40 loc) · 1.25 KB
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
name: Cpp code check
on:
pull_request:
paths:
- .github/workflows/cpp-code-check.yaml
- .clang-format
- '**.c'
- '**.cpp'
- '**.h'
- '**.hpp'
- '**.m'
- '**.mm'
- '!3party/**'
jobs:
clang-format-check:
name: Clang-format check
runs-on: ubuntu-24.04
steps:
- name: Calculate PR fetch depth
env:
COMMITS_COUNT: ${{ github.event.pull_request.commits }}
run: echo "PR_FETCH_DEPTH=$(($COMMITS_COUNT + 1))" >> "${GITHUB_ENV}"
- name: Checkout PR branch and all PR commits
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: ${{ env.PR_FETCH_DEPTH }}
- name: Install clang-format tool
run: sudo apt install -y clang-format
- name: Run git clang-format
env:
COMMITS_COUNT: ${{ github.event.pull_request.commits }}
run: |
git clang-format HEAD~$COMMITS_COUNT --extensions 'c,cpp,h,hpp,m,mm' || true
- name: Post clang-format comments
uses: reviewdog/action-suggester@v1.21.0
with:
tool_name: clang-format
fail_level: error