forked from trilinos/Trilinos
-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (41 loc) · 2.05 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
name: Check packages with clang-format
on: [pull_request]
permissions:
contents: read
pull-requests: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- uses: DoozyX/clang-format-lint-action@c71d0bf4e21876ebec3e5647491186f8797fde31 # v0.18.2
with:
source: './packages/muelu ./packages/tempus ./packages/teko ./packages/xpetra'
exclude: './packages/tempus/examples'
extensions: 'cpp,hpp'
clangFormatVersion: 14
inplace: true
- run: git diff HEAD > format_patch.txt
- run: if [ "$(cat format_patch.txt)" == "" ] ; then rm format_patch.txt ; else cat format_patch.txt; fi
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
id: upload-artf
if: ${{ hashFiles('format_patch.txt') != '' }}
with:
name: clang format patch
path: format_patch.txt
- name: Artifact ID test
run: |
echo "Artifact ID is ${{ steps.upload-artf.outputs.artifact-id }}"
echo "Link: ${{ steps.upload-artf.outputs.artifact-url }}"
# This does not work for PRs from forks.
- name: Post artifact in issue comment
uses: mshick/add-pr-comment@b8f338c590a895d50bcbfa6c5859251edc8952fc # v2.8.2
if: ${{ (hashFiles('format_patch.txt') != '') && (github.event.pull_request.head.repo.full_name == github.repository) }}
with:
message: |
Your PR updated files that did not respect package clang formatting settings. Please apply the patch found [here](${{ steps.upload-artf.outputs.artifact-url }})
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
if: ${{ hashFiles('format_patch.txt') != '' }}
with:
script: |
core.setFailed('Your PR updated files that did not respect package clang formatting settings. Please download and apply the formatting patch! It is located at the bottom of the summary tab for this workflow and at this link: ${{ steps.upload-artf.outputs.artifact-url }}')