-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (45 loc) · 1.85 KB
/
formatter.yml
File metadata and controls
50 lines (45 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Reusable Clang Format Check
on:
workflow_call:
secrets:
REPO_TOKEN:
required: true
CI_USER_APP_ID:
required: true
CI_USER_PRIVATE_KEY:
required: true
jobs:
formatter:
runs-on: [self-hosted, Linux]
steps:
- name: Generate token for pulling private repo
uses: actions/create-github-app-token@v3.2.0
id: generate_token
with:
client-id: ${{ secrets.CI_USER_APP_ID }}
private-key: ${{ secrets.CI_USER_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- name: Checkout code
uses: actions/checkout@v6.0.2
with:
token: ${{ steps.generate_token.outputs.token }}
path: main_repo
- name: Checkout formatter repo
uses: actions/checkout@v6.0.2
with:
repository: MapIV/map4_github_actions
token: ${{ steps.generate_token.outputs.token }}
path: formatter_repo
ref: v2025.07.23
- name: Install formatter
run: |
CODENAME=$(. /etc/os-release && echo "$UBUNTU_CODENAME")
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
echo "deb http://apt.llvm.org/${CODENAME}/ llvm-toolchain-${CODENAME}-18 main" | sudo tee /etc/apt/sources.list.d/llvm.list
sudo apt-get update
sudo apt-get install -y wget xz-utils python3-pip clang-format-18
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1
sudo update-alternatives --set python /usr/bin/python3
- name: Run C++ formatter
run: |
find main_repo -name "*.cpp" -or -name "*.cc" -or -name "*.cu" -or -name "*.h" -or -name "*.hpp" | xargs -n 1 ./formatter_repo/run-clang-format.py --config_file formatter_repo/.clang-format --recursive --color always