This repository was archived by the owner on Nov 27, 2025. It is now read-only.
Avoid copies in getChecked (cherry-pick from upstream) (#151) #184
Workflow file for this run
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_target: | |
| branches: | |
| - npu/release/20.x | |
| permissions: | |
| contents: read | |
| jobs: | |
| code_formatter: | |
| runs-on: ubuntu-24.04 | |
| if: (github.repository == 'llvm/llvm-project' || github.repository == 'intel/npu-plugin-llvm') && !contains(github.event.pull_request.labels.*.name, 'disable-lint') | |
| steps: | |
| - name: Fetch LLVM sources | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| fetch-depth: 2 | |
| - name: Get changed files | |
| id: changed-files | |
| uses: step-security/changed-files@3dbe17c78367e7d60f00d78ae6781a35be47b4a1 # v45.0.1 | |
| with: | |
| separator: "," | |
| skip_initial_fetch: true | |
| base_sha: 'HEAD~1' | |
| sha: 'HEAD' | |
| # 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@17c11551771948abc5752bbf3183482567c7caf0 # v1.1.1 | |
| with: | |
| clangformat: 20.1.8 | |
| - 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 }} | |
| run: | | |
| python ./code-format-tools/llvm/utils/git/code-format-helper.py \ | |
| --token ${{ secrets.GITHUB_TOKEN }} \ | |
| --issue-number $GITHUB_PR_NUMBER \ | |
| --start-rev HEAD~1 \ | |
| --end-rev HEAD \ | |
| --changed-files "$CHANGED_FILES" |