This repository was archived by the owner on Nov 27, 2025. It is now read-only.
Bump ubuntu from 20.04@sha256:8e5c4f0285ecbb4ead070431d29b576a530d3166df73ec44affc1cd27555141b to sha256:1e622c5f073b4f6bfad6632f2616c7f59ef256e96fe78bf6a595d1dc4376ac02 in /bolt/utils/docker #86
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "Check code formatting" | |
| on: | |
| pull_request: | |
| branches: | |
| - npu/release/18.x | |
| permissions: | |
| contents: read | |
| jobs: | |
| code_formatter: | |
| runs-on: ubuntu-latest | |
| if: (github.repository == 'llvm/llvm-project' || github.repository == 'intel/npu-plugin-llvm') && !contains(github.event.pull_request.labels.*.name, 'disable-lint') | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 | |
| with: | |
| egress-policy: audit | |
| - name: Fetch LLVM sources | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - name: Checkout through merge base | |
| uses: rmacklin/fetch-through-merge-base@bfe4d03a86f9afa52bc1a70e9814fc92a07f7b75 # v0.3.0 | |
| with: | |
| base_ref: ${{ github.event.pull_request.base.ref }} | |
| head_ref: ${{ github.event.pull_request.head.sha }} | |
| deepen_length: 500 | |
| - name: Get changed files | |
| id: changed-files | |
| uses: tj-actions/changed-files@d6e91a2266cdb9d62096cebf1e8546899c6aa18f # v45.0.6 | |
| with: | |
| separator: "," | |
| skip_initial_fetch: true | |
| # We need to make sure that we aren't executing/using any code from the | |
| # PR for security reasons as we're using pull_request_target. Checkout | |
| # the target branch with the necessary files. | |
| - name: Fetch code formatting utils | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| sparse-checkout: | | |
| llvm/utils/git/requirements_formatting.txt | |
| llvm/utils/git/code-format-helper.py | |
| sparse-checkout-cone-mode: false | |
| path: code-format-tools | |
| - name: "Listed files" | |
| env: | |
| CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | |
| run: | | |
| echo "Formatting files:" | |
| echo "$CHANGED_FILES" | |
| - name: Install clang-format | |
| uses: aminya/setup-cpp@12e62a1b8da8f1e66acc75305a2621234ef49dd0 # v1 | |
| with: | |
| clangformat: 17.0.1 | |
| - name: Setup Python env | |
| uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 | |
| with: | |
| python-version: '3.11' | |
| cache: 'pip' | |
| cache-dependency-path: 'code-format-tools/llvm/utils/git/requirements_formatting.txt' | |
| - name: Install python dependencies | |
| run: pip install -r code-format-tools/llvm/utils/git/requirements_formatting.txt | |
| - name: Run code formatter | |
| env: | |
| GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }} | |
| START_REV: ${{ github.event.pull_request.base.sha }} | |
| END_REV: ${{ github.event.pull_request.head.sha }} | |
| CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | |
| # TODO(boomanaiden154): Once clang v18 is released, we should be able | |
| # to take advantage of the new --diff_from_common_commit option | |
| # explicitly in code-format-helper.py and not have to diff starting at | |
| # the merge base. | |
| run: | | |
| python ./code-format-tools/llvm/utils/git/code-format-helper.py \ | |
| --token ${{ secrets.GITHUB_TOKEN }} \ | |
| --issue-number $GITHUB_PR_NUMBER \ | |
| --start-rev $(git merge-base $START_REV $END_REV) \ | |
| --end-rev $END_REV \ | |
| --changed-files "$CHANGED_FILES" |