-
-
Notifications
You must be signed in to change notification settings - Fork 16
55 lines (44 loc) · 1.59 KB
/
lint.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: Lint scripts
on:
workflow_dispatch:
pull_request:
concurrency:
group: linter-${{github.event.pull_request.number}}
cancel-in-progress: true
jobs:
Shellcheck:
name: Shell script analysis
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'Armbian' }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v45
- name: "Show which files we check"
shell: bash {0}
run: |
echo "# Checked files:" >> $GITHUB_STEP_SUMMARY
echo "${{ steps.changed-files.outputs.all_changed_files }}" | sed "s/ /\n/g" >> $GITHUB_STEP_SUMMARY
- name: Environment variables
run: sudo -E bash -c set
- name: "Shellcheck lint error report in diff format"
shell: bash {0}
run: |
if [[ -n "${{ steps.changed-files.outputs.all_changed_files }}" ]]; then
FILES="${{ steps.changed-files.outputs.all_changed_files }}"
for file in $FILES; do
if grep -qE "^#\!/.*bash" $file; then
shellcheck --severity=error $file || ret=$?
fi
done
else
FILES="$(find . -name "*.sh" ! -path '*/.git*/*' -exec grep -Iq . {} \; -print)"
for file in $FILES; do
if grep -qE "^#\!/.*bash" $file; then
shellcheck --severity=error $file || ret=$?
fi
done
fi
exit $ret