-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (49 loc) · 1.59 KB
/
autoformat.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
43
44
45
46
47
48
49
50
51
52
53
54
55
name: auto-format
on: [push]
env:
GO_VERSION: go1.18.3
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Fetch install script
run: |
sudo apt-get update
sudo apt-get install -y \
bison \
curl \
git \
shellcheck \
python3-setuptools \
python-setuptools \
python3-pip \
python3-virtualenv \
luarocks \
golang
chmod +x ./install.sh
./install.sh --nolog --portables --verbose --force
# FIX: Temporally fix as currently the latest tag does not have a release
rm -f ~/.local/bin/shfmt
bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
source "$HOME/.gvm/scripts/gvm"
gvm install "$GO_VERSION" -B
gvm use "$GO_VERSION" --default
go install mvdan.cc/sh/v3/cmd/shfmt@latest
echo "$HOME/.local/bin" >> $GITHUB_PATH
echo "$HOME/.gvm/pkgsets/$GO_VERSION/global/bin/" >> $GITHUB_PATH
- name: Stylua
run: |
stylua -s .
- name: Shfmt
run: |
source "$HOME/.gvm/scripts/gvm"
shfmt -i 4 -s -ci -kp -w .
shfmt -i 4 -s -ci -kp -w ./shell/zfunctions/*
- uses: EndBug/add-and-commit@v4
with:
author_name: Autoformatter
author_email: [email protected]
message: ':art: Committing stylua and shfmt changes'
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}