-
Notifications
You must be signed in to change notification settings - Fork 1
57 lines (49 loc) · 1.38 KB
/
Copy pathbashisms.yml
File metadata and controls
57 lines (49 loc) · 1.38 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
50
51
52
53
54
55
56
57
name: Check for bashisms
permissions:
contents: read
on:
push:
branches:
- main
- dev
paths:
- "**/*.sh"
pull_request:
branches:
- main
- dev
paths:
- "**/*.sh"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
bashisms:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
# Get the list of script files in the root folder
- name: Get a list of script files
id: get_sh_files
run: |
if sh_files=$(find . -type f -name "*.sh" -print); then
echo "Shell files found:"
echo "$sh_files"
echo "has_files=true" >> $GITHUB_OUTPUT
else
echo "has_files=false" >> $GITHUB_OUTPUT
fi
- name: Install devscripts
if: steps.get_sh_files.outputs.has_files == 'true'
run: sudo apt-get update && sudo apt-get install -y devscripts
- name: Check for bashisms
if: steps.get_sh_files.outputs.has_files == 'true'
run: |
find . -type f -name "*.sh" -print0 | while IFS= read -r -d '' file; do
echo "Running checkbashisms for $file"
checkbashisms "$file" || true
done