feat(shellcheck): add shell check for shell and pipeline

This commit is contained in:
guzhongren 2022-01-22 15:24:50 +08:00
parent abea078a67
commit e19896e3a0
No known key found for this signature in database
GPG Key ID: D18AEC180356622D
3 changed files with 21 additions and 8 deletions

View File

@ -26,11 +26,5 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
# Runs a single command using the runners shell # Runs a single command using the runners shell
- name: Run a one-line script - name: shell check
run: echo Hello, world! run: docker-compose run --rm shellcheck ./validate.sh
# Runs a set of commands using the runners shell
- name: Run a multi-line script
run: |
echo Add other actions to build,
echo test, and deploy your project.

8
docker-compose.yaml Normal file
View File

@ -0,0 +1,8 @@
---
version: '3.9'
services:
shellcheck:
image: koalaman/shellcheck-alpine:latest
volumes:
- ".:/build"
working_dir: /build

11
validate.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh -l
set -euo pipefile
rc=0
for filename in $(find ./* -name '*.sh'); do
echo "Validating"
shellcheck "${filename}" || exit $?
done
exit $?