1 #!/bin/bash
2
3 list=""
4 app="www/"
5 path="../apps/$1"
6 exceptions=("${@:2}")
7 exceptionsCommand=""
8
9 for index in ${!exceptions[@]}
10 do
11 exceptionsCommand+="-not -path $path/${exceptions[$index]} "
12 done
13
14 # get directories in content other than reference
15 for i in `find $path -type d -maxdepth 1 -not -path $path $exceptionsCommand`
16 do
17 if [ ${#list} -gt 0 ]; then
18 list+=','
19 fi
20 list+="\"$app${i#../}\""
21 done
22 #get files in content (not nested)
23 for i in `find $path -type f -maxdepth 1 $exceptionsCommand`
24 do
25 if [ ${#list} -gt 0 ]; then
26 list+=','
27 fi
28 list+="\"$app${i#../}\""
29 done
30 echo "::set-output name=LIST::[$list]"