mirror of
https://github.com/LukeSmithxyz/voidrice.git
synced 2026-03-20 01:37:45 +01:00
- Format all shell scripts using [shfmt] (https://github.com/mvdan/sh). Options used: * `-bn`: binary ops like && and | may start a line * `-sr`: redirect operators will be followed by a space * `-ci`: indent switch cases * `-i 4`: indent 4 spaces * `-s`: simplify the code * `-p`: parse for posix compliance - Add Github action to lint changes to scripts and enforce formatting going forward Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
39 lines
911 B
YAML
39 lines
911 B
YAML
name: shfmt-linter
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
shellcheck:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
ref: ${{ github.head_ref }}
|
|
|
|
- name: update system
|
|
run: |
|
|
sudo apt-get upgrade --install-suggests --yes
|
|
|
|
- name: install dependencies
|
|
run: |
|
|
sudo apt-get install git \
|
|
make
|
|
|
|
- name: apply shfmt fixes
|
|
run: |
|
|
docker run --volume "$PWD":/mnt \
|
|
--rm \
|
|
mvdan/shfmt -bn -ci -d -i 4 -p -s -sr -w /mnt
|
|
|
|
- uses: stefanzweifel/git-auto-commit-action@v4
|
|
with:
|
|
commit_message: (maint) apply shfmt formatting
|
|
commit_options: '--cleanup=default --no-verify --signoff'
|
|
push_options: '--force'
|
|
skip_dirty_check: false
|