-
Notifications
You must be signed in to change notification settings - Fork 302
41 lines (37 loc) · 1.56 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
name: clang-format
# Report style formatting changes.
# Run git-clang-format on the contents of the PR against the target commit and display a diff of
# any recommended changes. Fail the job if any are recommended.
#
# Future work would be to have a way to apply these automatically which would require making and
# pushing a new git commit so should be optional.
#
# Runs in a fedora docker container to get a recent clang-format version.
#
# This checks out the tree with the default settings - a merge commit of the PR with the target
# branch, then it applies git-clang-format which only works against branches, not where branches
# diverge, and then it removes any changes to auto-generated files. The result should be something
# that can be applied to the PR however it may not apply cleanly if there are merge issues with
# master - although in this case the PR should be merged with the target before landing in any case.
on:
pull_request:
permissions: {}
jobs:
pylint:
name: Clang Format
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Pull via git
run: git fetch origin ${{ github.event.pull_request.base.ref }}
- name: Run check in docker
uses: ./.github/actions/clang-format
with:
target: origin/${{ github.event.pull_request.base.ref }}
- name: Export changes
uses: actions/upload-artifact@v4
if: failure()
with:
name: format-patch-for-pr-${{ github.event.pull_request.number }}
path: auto-format-changes.diff