-
Notifications
You must be signed in to change notification settings - Fork 7
39 lines (34 loc) · 998 Bytes
/
ci-format.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
name: "format"
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Mount bazel cache
uses: actions/cache@v3
with:
path: "~/.cache/bazel" # See https://docs.bazel.build/versions/master/output_directories.html
key: format-${{ hashFiles('**/*_deps.bzl', '**/*.bazelrc') }}
restore-keys: |
format
- name: Run format.sh
run: ./format.sh
- name: Check formatting diff
run: |
CHANGED_FILES="$(git diff-index --name-only HEAD --)"
if [[ -z "${CHANGED_FILES}" ]]; then
echo "Success: no formatting changes needed."
exit 0
fi
echo "Found formatting changes in the following files:"
echo "${CHANGED_FILES}"
echo ""
echo "Please run format.sh to apply the changes."
exit 1