-
-
Notifications
You must be signed in to change notification settings - Fork 379
41 lines (31 loc) · 1.25 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
# Check all pull requests against the clang-format rules.
name: Clang Format
# Controls when the action will run.
# Run clang-format checks on all pull-requests
on:
pull_request:
paths:
- 'src/**.cpp'
- 'src/**.h'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-format
cancel-in-progress: ${{ github.ref == 'refs/heads/master' }}
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
clang-format-check:
timeout-minutes: 5
# Ubuntu 18.04 at the time of writing includes clang-format-9 as default
runs-on: [ubuntu-20.04]
# We want to check all changed files between the pull-request base and the head of the pull request
env:
FORMAT_BASE: ${{ github.base_ref }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checkout the repository as $GITHUB_WORKSPACE
- uses: actions/checkout@v3
# Make sure to include the base we want to merge into
- run: |
git fetch --no-tags --depth=1 origin ${{ github.base_ref }}:${{ github.base_ref }}
# Run the clang-format command (in $GITHUB_WORKSPACE, which is where the repo is checked out to)
- name: Run clang-format
run: ./scripts/clang-format.sh