Skip to content

Commit 867b6a1

Browse files
committed
Add formatting action
1 parent bc6a1a6 commit 867b6a1

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Check formatting
2+
3+
# Controls when the action will run.
4+
on:
5+
push:
6+
branches: [ main ]
7+
pull_request:
8+
branches: [ main ]
9+
10+
workflow_dispatch:
11+
12+
jobs:
13+
check_formatting:
14+
runs-on: ubuntu-20.04
15+
16+
steps:
17+
- uses: actions/checkout@v2
18+
19+
- name: Setup Go environment
20+
uses: actions/setup-go@v2
21+
with:
22+
go-version: '^1.15.5'
23+
24+
- name: Install formatters
25+
run: |
26+
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
27+
sudo apt-get install software-properties-common
28+
sudo add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-11 main'
29+
sudo apt-get install clang-format-11
30+
curl -sSLO https://github.com/pinterest/ktlint/releases/download/0.40.0/ktlint && chmod a+x ktlint && sudo mv ktlint /usr/bin/ktlint
31+
go get -u github.com/google/addlicense
32+
go get github.com/bazelbuild/buildtools/buildifier
33+
34+
- name: Run format.sh and print changes
35+
run: |
36+
./format.sh
37+
clang-format --version
38+
git diff
39+
40+
- name: Check for changes
41+
run: "[ $(git status --porcelain | wc -l) -eq 0 ]"

0 commit comments

Comments
 (0)