-
Notifications
You must be signed in to change notification settings - Fork 73
42 lines (35 loc) · 1.27 KB
/
Copy pathlint.yml
File metadata and controls
42 lines (35 loc) · 1.27 KB
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
name: Shell Script Linter
permissions:
contents: read
on:
push:
branches: [ "main", "test", "dev"]
paths: [ "du_setup.sh", "README.me", ".github/workflows/lint.yml" ]
pull_request:
branches: [ "main" ]
paths: [ "du_setup.sh", "README.me", ".github/workflows/lint.yml" ]
jobs:
shellcheck:
name: Shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Install ShellCheck
run: sudo apt-get update && sudo apt-get install -y shellcheck
- name: Run Shellcheck
run: |
set -o pipefail
files_to_check=$(find . -type f -name "*.sh" -not -path "./.git/*")
if [ -z "$files_to_check" ]; then
echo "No .sh files found to check."
exit 0
fi
echo "--- Checking for all warnings and style issues ---"
echo "$files_to_check" | xargs shellcheck -f gcc | while IFS= read -r line; do
file=$(echo "$line" | cut -d: -f1)
line_no=$(echo "$line" | cut -d: -f2)
message=$(echo "$line" | cut -d: -f4-)
echo "::warning file=$file,line=$line_no::$message"
done || true
echo "--- Checking for critical errors ---"
echo "$files_to_check" | xargs shellcheck --severity=error