Skip to content

Commit 57c4238

Browse files
committed
Reset clang-format-check to hand-written version.
The experiment with using cpp-linter action has failed. Most of the PRs created from forks, but cpp-linter can't leave comments in such PRs. Comments are allowed only for PRs created from the local branches. I tried to use GitHub Actions summary to report the check results, but it's not as informative as our version - it doesn't include diff. This reverts following commits 8a9d879, 1332005, 7cff40f.
1 parent 8a9d879 commit 57c4238

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

.github/workflows/cts_ci.yml

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -86,23 +86,24 @@ jobs:
8686
8787
check-clang-format:
8888
if: github.event_name == 'pull_request'
89-
90-
runs-on: ubuntu-latest
91-
permissions:
92-
contents: read
93-
pull-requests: read
89+
runs-on: "ubuntu-22.04"
9490
steps:
95-
- uses: actions/checkout@v5
96-
- uses: cpp-linter/cpp-linter-action@v2
97-
id: linter
98-
env:
99-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91+
- name: Checkout
92+
uses: actions/checkout@v3
10093
with:
101-
style: file
102-
version: '21'
103-
tidy-checks: '-*' # Disable all clang-tidy checks for now. Enable checks as needed.
104-
step-summary: true
105-
lines-changed-only: true
94+
fetch-depth: 0 # Need to check out base branch as well
95+
- name: Run clang-format on changed files
96+
run: |
97+
set -o errexit -o pipefail -o noclobber -o nounset
98+
DIFF=$( git diff -U0 --no-color ${{ github.event.pull_request.base.sha }} | clang-format-diff-14 -p1 )
99+
if [ ! -z "$DIFF" ]; then
100+
echo 'The following changes are not formatted according to `clang-format`:' >> $GITHUB_STEP_SUMMARY
101+
echo '```diff' >> $GITHUB_STEP_SUMMARY
102+
echo "$DIFF" >> $GITHUB_STEP_SUMMARY
103+
echo '```' >> $GITHUB_STEP_SUMMARY
104+
echo "Not all files are formatted according to clang-format. See workflow summary for details."
105+
exit 1 # Fail CI run
106+
fi
106107
107108
compile-cts:
108109
needs: build-image-for-sycl-impl

0 commit comments

Comments
 (0)