1 name: "Check code formatting"
2 on: pull_request_target
10 - name: Fetch LLVM sources
11 uses: actions/checkout@v4
13 fetch-depth: 2 # Fetches only the last 2 commits
15 - name: Get changed files
17 uses: tj-actions/changed-files@v39
20 fetch_depth: 2000 # Fetches only the last 2000 commits
22 - name: "Listed files"
24 echo "Formatting files:"
25 echo "${{ steps.changed-files.outputs.all_changed_files }}"
27 - name: Install clang-format
28 uses: aminya/setup-cpp@v1
32 - name: Setup Python env
33 uses: actions/setup-python@v4
35 python-version: '3.11'
37 cache-dependency-path: 'llvm/utils/git/requirements_formatting.txt'
39 - name: Install python dependencies
40 run: pip install -r llvm/utils/git/requirements_formatting.txt
42 - name: Run code formatter
44 GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
45 START_REV: ${{ github.event.pull_request.base.sha }}
46 END_REV: ${{ github.event.pull_request.head.sha }}
47 CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
49 python llvm/utils/git/code-format-helper.py \
50 --token ${{ secrets.GITHUB_TOKEN }} \
51 --issue-number $GITHUB_PR_NUMBER \
52 --start-rev $START_REV \
54 --changed-files "$CHANGED_FILES"