forked from firebase/quickstart-android
- Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_pull_request.sh
executable file
·34 lines (28 loc) · 839 Bytes
/
build_pull_request.sh
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
# Exit on error
set -e
# unshallow since GitHub actions does a shallow clone
git fetch --unshallow
git fetch origin
# Get all the modules that were changed
whileread line;do
module_name=${line%%/*}
if [[ ${MODULES}!=*"${module_name}" ]];then
MODULES="${MODULES}${module_name}"
fi
done<<(git diff --name-only origin/$GITHUB_BASE_REF)
changed_modules=$MODULES
# Get a list of all available gradle tasks
AVAILABLE_TASKS=$(./gradlew tasks --all)
# Check if these modules have gradle tasks
build_commands=""
formodulein$changed_modules
do
if [[ $AVAILABLE_TASKS=~$module":app:" ]];then
build_commands=${build_commands}" :"${module}":app:assembleDebug :"${module}":app:check"
fi
done
# Build
echo"Building Pull Request with"
echo$build_commands
eval"./gradlew clean ktlint ${build_commands}"