Skip to content
28 changes: 10 additions & 18 deletions .github/workflows/pr-code-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ on:
jobs:
code_formatter:
runs-on: ubuntu-24.04
container:
image: 'ghcr.io/llvm/ci-ubuntu-24.04-format'
timeout-minutes: 30
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
Expand All @@ -23,6 +25,14 @@ jobs:
with:
fetch-depth: 2

# We need to set the repo checkout as safe, otherwise tj-actions/changed-files
# will fail due to the changed ownership inside the container.
# TODO(boomanaiden154): We should probably fix this by having the default user
# in the container have the same ID as the GHA user on the host.
- name: Set Safe Directory
run: |
chown -R root $(pwd)

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46.0.5
Expand All @@ -39,24 +49,6 @@ jobs:
echo "Formatting files:"
echo "$CHANGED_FILES"

# The clang format version should always be upgraded to the first version
# of a release cycle (x.1.0) or the last version of a release cycle, or
# if there have been relevant clang-format backports.
- name: Install clang-format
uses: aminya/setup-cpp@a276e6e3d1db9160db5edc458e99a30d3b109949 # v1.7.1
with:
clangformat: 21.1.0

- name: Setup Python env
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: '3.13'
cache: 'pip'
cache-dependency-path: 'llvm/utils/git/requirements_formatting.txt'

- name: Install python dependencies
run: pip install -r llvm/utils/git/requirements_formatting.txt

- name: Run code formatter
env:
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
Expand Down
Loading