Skip to content

Commit da513e7

Browse files
fix(lint): ensure clang-format versions match
1 parent f4be7ac commit da513e7

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

.github/workflows/__call-common-lint.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
# This workflow will lint the code in the repository using various tools. Most linting tools in LizardByte
3-
# should be included in this workflow; however there are cases where that is not true, such as with eslint.
3+
# should be included in this workflow; however, there are cases where that is not true, such as with eslint.
44

55
name: common lint (called)
66
permissions:
@@ -20,6 +20,8 @@ jobs:
2020
lint:
2121
name: Common Lint
2222
runs-on: ubuntu-latest
23+
env:
24+
CLANG_FORMAT_VERSION: 20
2325
steps:
2426
- name: Checkout
2527
uses: actions/checkout@v5
@@ -74,7 +76,7 @@ jobs:
7476
run: |
7577
# shellcheck disable=SC2102 # this is triggered by the [toolchain] extra
7678
python -m pip install --upgrade \
77-
clang-format \
79+
"clang-format==${CLANG_FORMAT_VERSION}.*" \
7880
pip \
7981
setuptools \
8082
wheel \
@@ -162,17 +164,18 @@ jobs:
162164
echo found_files=${found_files} >> "${GITHUB_OUTPUT}"
163165
164166
- name: C++ - Clang format (diff)
167+
id: clang_format_diff
165168
if: always() && steps.cpp_files.outputs.found_files
166169
uses: DoozyX/clang-format-lint-action@v0.20
167170
with:
168171
source: ${{ steps.cpp_files.outputs.found_files }}
169-
clangFormatVersion: '20'
172+
clangFormatVersion: '${{ env.CLANG_FORMAT_VERSION }}'
170173
extensions: 'c,cpp,h,hpp,m,mm'
171174
style: file
172175
inplace: false
173176

174177
- name: C++ - Clang format (simple)
175-
if: always() && steps.cpp_files.outputs.found_files
178+
if: always() && steps.clang_format_diff.outcome == 'failure'
176179
run: |
177180
echo "::add-matcher::.github/matchers/clang-format.json"
178181
set +e

0 commit comments

Comments
 (0)