11name : " Check code formatting"
22
33on :
4- pull_request :
4+ pull_request_target :
55 branches :
66 - npu/release/20.x
77
@@ -10,32 +10,22 @@ permissions:
1010
1111jobs :
1212 code_formatter :
13- runs-on : ubuntu-latest
13+ runs-on : ubuntu-24.04
1414 if : (github.repository == 'llvm/llvm-project' || github.repository == 'intel/npu-plugin-llvm') && !contains(github.event.pull_request.labels.*.name, 'disable-lint')
1515 steps :
16- - name : Harden Runner
17- uses : step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
18- with :
19- egress-policy : audit
20-
2116 - name : Fetch LLVM sources
2217 uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2318 with :
24- ref : ${{ github.event.pull_request.head.sha }}
25-
26- - name : Checkout through merge base
27- uses : rmacklin/fetch-through-merge-base@bfe4d03a86f9afa52bc1a70e9814fc92a07f7b75 # v0.3.0
28- with :
29- base_ref : ${{ github.event.pull_request.base.ref }}
30- head_ref : ${{ github.event.pull_request.head.sha }}
31- deepen_length : 500
19+ fetch-depth : 2
3220
3321 - name : Get changed files
3422 id : changed-files
35- uses : tj-actions /changed-files@d6e91a2266cdb9d62096cebf1e8546899c6aa18f # v45.0.6
23+ uses : step-security /changed-files@3dbe17c78367e7d60f00d78ae6781a35be47b4a1 # v45.0.1
3624 with :
3725 separator : " ,"
3826 skip_initial_fetch : true
27+ base_sha : ' HEAD~1'
28+ sha : ' HEAD'
3929
4030 # We need to make sure that we aren't executing/using any code from the
4131 # PR for security reasons as we're using pull_request_target. Checkout
5747 echo "$CHANGED_FILES"
5848
5949 - name : Install clang-format
60- uses : aminya/setup-cpp@12e62a1b8da8f1e66acc75305a2621234ef49dd0 # v1
50+ uses : aminya/setup-cpp@17c11551771948abc5752bbf3183482567c7caf0 # v1.1.1
6151 with :
62- clangformat : 17.0.1
52+ clangformat : 20.1.8
6353
6454 - name : Setup Python env
6555 uses : actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
@@ -77,14 +67,10 @@ jobs:
7767 START_REV : ${{ github.event.pull_request.base.sha }}
7868 END_REV : ${{ github.event.pull_request.head.sha }}
7969 CHANGED_FILES : ${{ steps.changed-files.outputs.all_changed_files }}
80- # TODO(boomanaiden154): Once clang v18 is released, we should be able
81- # to take advantage of the new --diff_from_common_commit option
82- # explicitly in code-format-helper.py and not have to diff starting at
83- # the merge base.
8470 run : |
8571 python ./code-format-tools/llvm/utils/git/code-format-helper.py \
8672 --token ${{ secrets.GITHUB_TOKEN }} \
8773 --issue-number $GITHUB_PR_NUMBER \
88- --start-rev $(git merge-base $START_REV $END_REV) \
89- --end-rev $END_REV \
74+ --start-rev HEAD~1 \
75+ --end-rev HEAD \
9076 --changed-files "$CHANGED_FILES"
0 commit comments