-
Notifications
You must be signed in to change notification settings - Fork 21
57 lines (49 loc) · 1.96 KB
/
Copy pathcpp-linter.yml
File metadata and controls
57 lines (49 loc) · 1.96 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
46
47
48
49
50
51
52
53
54
55
56
57
name: cpp-linter
on:
pull_request:
types: [opened, reopened, synchronize]
paths: ['**.c', '**.h', '**.cpp', '**.hpp', '.clang-format', '.github/workflows/cpp-linter.yml']
push:
# Branch-scoped: path filters are ignored for tag pushes, so without this a
# release tag would trigger a full compiledb build + hard-failing lint.
branches: [develop, beta, master]
paths: ['**.c', '**.h', '**.cpp', '**.hpp', '.clang-format', '.github/workflows/cpp-linter.yml']
workflow_dispatch: # Manually invoked by user.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
cpp-linter:
name: C/C++ Linter
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: ./.github/actions/build-compilationdb
with:
version: 0.0.0-test+build # Doesn't matter, just need the compilation database
- uses: cpp-linter/cpp-linter-action@8e85cd02c8c3fe3ae527c94b5683fe2366b144ed # v2.20.0
id: linter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
style: file
version: 21
ignore: |
.github
include/serialization/_fbs
# Commit comments (push events) need contents:write, which this job
# deliberately does not grant; only post thread comments on PRs, where
# pull-requests:write applies. Otherwise the action 403s and fails the
# job even when the lint is clean.
thread-comments: ${{ github.event_name == 'pull_request' && 'update' || 'false' }}
no-lgtm: false
- name: Fail fast?!
if: steps.linter.outputs.checks-failed > 0
run: |
echo "::error::Some files failed the linting checks!"
exit 1