-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (39 loc) · 1.02 KB
/
Copy pathshellcheck.yml
File metadata and controls
43 lines (39 loc) · 1.02 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
43
---
name: ShellCheck
'on':
pull_request:
push:
branches: [main]
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
shellcheck:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install ShellCheck
run: |
sudo apt-get update
sudo apt-get install -y shellcheck
- name: Run ShellCheck
shell: bash
run: |
set -euo pipefail
mapfile -t files < <(git ls-files -- \
':(glob)**/*.sh' \
':(glob)**/*.bash' \
':(glob)**/*.zsh' \
':(glob)**/.bashrc' \
':(glob)**/.bash_aliases' \
':(glob)**/.zshrc' \
':(glob)**/.profile')
if [ "${#files[@]}" -eq 0 ]; then
echo "No shell files to check."
exit 0
fi
echo "Checking ${#files[@]} file(s) with ShellCheck..."
shellcheck -S error -x "${files[@]}"