@@ -12,8 +12,24 @@ shell.exec('git fetch origin');
1212// Get all changed modules
1313
1414const baseBranch = 'origin/' + process . env . GITHUB_BASE_REF ;
15- shell . exec ( 'git diff --name-only ' + baseBranch , function ( code , stdout , stderr ) {
16- console . log ( 'Exit code:' , code ) ;
17- console . log ( 'Std Out:' , stdout ) ;
18- console . log ( 'Std Error:' , stderr ) ;
15+
16+ let changed_modules = [ ] ;
17+ shell . exec ( 'git diff --name-only ' + baseBranch , { silent :true } , function ( code , stdout , stderr ) {
18+ let changedFiles = stdout . split ( / \r ? \n / ) ;
19+ let moduleName = fileName . split ( '/' )
20+ if ( ! changed_modules . includes ( moduleName [ 0 ] ) ) {
21+ changed_modules . put ( moduleName [ 0 ] ) ;
22+ }
23+
24+ let availableTasks = shell . exec ( './gradlew tasks --all' , { silent :true } ) . stdout ;
25+
26+ let buildCommands = "" ;
27+ changed_modules . forEach ( function ( module ) {
28+ if ( availableTasks . includes ( module + ':app:' ) ) {
29+ buildCommands += " :" + module + ":app:" + forEachModule + " :" + module + ":app:check" ;
30+ }
31+ } ) ;
32+
33+ console . log ( 'Build Pull Request with:' , buildCommands ) ;
34+ shell . exec ( '.gradlew ' + forAllModules + ' ' + buildCommands ) ;
1935} ) ;
0 commit comments