-
Notifications
You must be signed in to change notification settings - Fork 59
49 lines (40 loc) · 1.3 KB
/
aomp-shell.yml
File metadata and controls
49 lines (40 loc) · 1.3 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
44
45
46
47
48
49
name: AOMP shellcheck lint
on:
pull_request:
jobs:
aomp-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 2
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@22103cc46bda19c2b464ffe86db46df6922fd323
with:
separator: ' '
skip_initial_fetch: true
base_sha: 'HEAD~1'
sha: 'HEAD'
- name: Echo changed files
run: |
echo "Changed files: ${{ steps.changed-files.outputs.all_changed_files }}"
echo "Git diff files: $(git diff --name-only HEAD~1 HEAD)"
- name: Run shellcheck
run: |
shellcheck_status=0
while read -r file; do
if [[ "$file" == *.sh ]] || [[ $(file "$file") =~ "shell script" ]]; then
file_dir=$(dirname "$file")
file_name=$(basename "$file")
echo "Running shellcheck on $file in directory $file_dir"
pushd "$file_dir" || exit 1
if ! shellcheck -x "$file_name"; then
shellcheck_status=1
fi
popd || exit 1
fi
done <<< $(git diff --name-only HEAD~1 HEAD)
exit $shellcheck_status
shell: bash {0}