-
Notifications
You must be signed in to change notification settings - Fork 21
43 lines (35 loc) · 1015 Bytes
/
format-check.yml
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
name: Apply clang-format
on:
push:
branches:
- 'trunk'
pull_request:
jobs:
clang-format:
runs-on: ubuntu-latest
steps:
- name: Install just
uses: extractions/setup-just@v2
with:
just-version: 1.26.0
- uses: actions/checkout@v4
- name: Pull latest changes
run: |
git fetch origin ${GITHUB_HEAD_REF}
git checkout ${GITHUB_HEAD_REF}
git pull origin ${GITHUB_HEAD_REF}
- name: Run format check on the C++
run: just install-denv init format-cpp
- name: Set up git user as the bot
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
- name: Auto-commit the changes
run: |
git add .
git commit -m "Apply clang-format" || echo "No changes to commit"
id: commit
- name: Push changes
if: github.ref != 'refs/heads/trunk'
run: |
git push origin HEAD:${GITHUB_HEAD_REF}