-
Notifications
You must be signed in to change notification settings - Fork 118
43 lines (37 loc) · 1.21 KB
/
formatting.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: Check formatting
concurrency:
# Don't cancel on master, creating a PR when a push workflow is already going will cancel the push workflow in favour of the PR workflow
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.run_id || github.event.number && github.head_ref || github.ref_name }}
cancel-in-progress: true
on:
merge_group:
push:
branches:
- release/**
pull_request:
branches:
- master
- release/**
jobs:
all:
name: C/C++, CMake and Python
runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Update submodule
working-directory: ${{runner.workspace}}/nrn
run: git submodule update --init external/coding-conventions
- name: Check formatting
working-directory: ${{runner.workspace}}/nrn
run: |
external/coding-conventions/bin/format
modified_files=$(git diff --name-only)
if [ -n "$modified_files" ]; then
echo "Some files are not well formatted:"
echo "$modified_files"
echo ""
echo "The diff is:"
git --no-pager diff
exit 1
fi