forked from opentiny/tiny-engine-backend-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodeql-matrix.sh
More file actions
34 lines (25 loc) · 772 Bytes
/
Copy pathcodeql-matrix.sh
File metadata and controls
34 lines (25 loc) · 772 Bytes
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
#!/bin/bash
set -euo pipefail
java_build_mode="${1:-autobuild}"
matrix_entries=""
has_files() {
git ls-files "$@" | grep . >/dev/null
}
add_entry() {
local entry="$1"
if [ -n "$matrix_entries" ]; then
matrix_entries="$matrix_entries,$entry"
else
matrix_entries="$entry"
fi
}
if has_files '.github/workflows/*.yml' '.github/workflows/*.yaml'; then
add_entry '{"language":"actions","build-mode":"none"}'
fi
if has_files '*.java'; then
add_entry "{\"language\":\"java-kotlin\",\"build-mode\":\"$java_build_mode\"}"
fi
if has_files '*.js' '*.jsx' '*.ts' '*.tsx' '*.mjs' '*.cjs' '*.vue' '*.html'; then
add_entry '{"language":"javascript-typescript","build-mode":"none"}'
fi
printf '{"include":[%s]}\n' "$matrix_entries"