@@ -10,6 +10,9 @@ current_commit="$4"
1010# List of all native widgets
1111all_widgets=' ["accordion-native","activity-indicator-native","animation-native","app-events-native","background-gradient-native","background-image-native","badge-native","bar-chart-native","barcode-scanner-native","bottom-sheet-native","carousel-native","color-picker-native","column-chart-native","feedback-native","floating-action-button-native","gallery-native","gallery-text-filter-native","image-native","intro-screen-native","line-chart-native","listview-swipe-native","maps-native","pie-doughnut-chart-native","popup-menu-native","progress-bar-native","progress-circle-native","qr-code-native","radio-buttons-native","range-slider-native","rating-native","repeater-native","safe-area-view-native","signature-native","slider-native","switch-native","toggle-buttons-native","video-player-native","web-view-native"]'
1212
13+ # Combined widgets and JS actions for default cases
14+ all_widgets_and_js=' ["accordion-native","activity-indicator-native","animation-native","app-events-native","background-gradient-native","background-image-native","badge-native","bar-chart-native","barcode-scanner-native","bottom-sheet-native","carousel-native","color-picker-native","column-chart-native","feedback-native","floating-action-button-native","gallery-native","gallery-text-filter-native","image-native","intro-screen-native","line-chart-native","listview-swipe-native","maps-native","pie-doughnut-chart-native","popup-menu-native","progress-bar-native","progress-circle-native","qr-code-native","radio-buttons-native","range-slider-native","rating-native","repeater-native","safe-area-view-native","signature-native","slider-native","switch-native","toggle-buttons-native","video-player-native","web-view-native","mobile-resources-native","nanoflow-actions-native"]'
15+
1316if [ " $event_name " == " pull_request" ]; then
1417 if git cat-file -e " $before_commit " 2> /dev/null; then
1518 changed_files=$( git diff --name-only " $before_commit " " $current_commit " )
@@ -19,24 +22,42 @@ if [ "$event_name" == "pull_request" ]; then
1922 fi
2023
2124 selected_workspaces=" "
25+ js_actions_changed=false
26+
2227 for file in $changed_files ; do
2328 if [[ $file == packages/pluggableWidgets/* ]]; then
2429 widget=$( echo $file | cut -d' /' -f3)
2530 if [[ ! $selected_workspaces =~ $widget ]]; then
2631 selected_workspaces=" $selected_workspaces $widget "
2732 fi
33+ elif [[ $file == packages/jsActions/mobile-resources-native/* ]] || [[ $file == packages/jsActions/nanoflow-actions-native/* ]]; then
34+ js_actions_changed=true
2835 fi
2936 done
3037
3138 # Trim leading and trailing spaces from selected_workspaces
3239 selected_workspaces=$( echo $selected_workspaces | xargs)
3340
34- if [[ -n " $selected_workspaces " ]]; then
41+ # Build the final scope and widgets output
42+ if [[ -n " $selected_workspaces " ]] && [[ " $js_actions_changed " == " true" ]]; then
43+ # Both widgets and JS actions changed
44+ # Convert space-separated widget names to JSON array format
45+ widget_array=$( echo " $selected_workspaces " | sed ' s/ /","/g' )
46+ echo " scope=--all --include '$selected_workspaces mobile-resources-native nanoflow-actions-native'" >> $GITHUB_OUTPUT
47+ echo " widgets=[\" $widget_array \" ,\" mobile-resources-native\" ,\" nanoflow-actions-native\" ]" >> $GITHUB_OUTPUT
48+ elif [[ -n " $selected_workspaces " ]] && [[ " $js_actions_changed " == " false" ]]; then
49+ # Only widgets changed
50+ widget_array=$( echo " $selected_workspaces " | sed ' s/ /","/g' )
3551 echo " scope=--all --include '$selected_workspaces '" >> $GITHUB_OUTPUT
36- echo " widgets=[\" $selected_workspaces \" ]" >> $GITHUB_OUTPUT
52+ echo " widgets=[\" $widget_array \" ]" >> $GITHUB_OUTPUT
53+ elif [[ -z " $selected_workspaces " ]] && [[ " $js_actions_changed " == " true" ]]; then
54+ # Only JS actions changed
55+ echo " scope=--all --include 'mobile-resources-native nanoflow-actions-native'" >> $GITHUB_OUTPUT
56+ echo " widgets=[\" mobile-resources-native\" ,\" nanoflow-actions-native\" ]" >> $GITHUB_OUTPUT
3757 else
38- echo " scope=--all --include '*-native'" >> $GITHUB_OUTPUT
39- echo " widgets=${all_widgets} " >> $GITHUB_OUTPUT
58+ # No specific changes detected in widgets or JS actions, run everything
59+ echo " scope=--all --include '*-native mobile-resources-native nanoflow-actions-native'" >> $GITHUB_OUTPUT
60+ echo " widgets=${all_widgets_and_js} " >> $GITHUB_OUTPUT
4061 fi
4162else
4263 if [ -n " $input_workspace " ] && [ " $input_workspace " != " *-native" ] && [ " $input_workspace " != " js-actions" ]; then
4768 echo " scope=--all --include 'mobile-resources-native nanoflow-actions-native'" >> $GITHUB_OUTPUT
4869 echo " widgets=[\" mobile-resources-native\" ,\" nanoflow-actions-native\" ]" >> $GITHUB_OUTPUT
4970 else
50- echo " scope=--all --include '*-native'" >> $GITHUB_OUTPUT
51- echo " widgets=${all_widgets } " >> $GITHUB_OUTPUT
71+ echo " scope=--all --include '*-native mobile-resources-native nanoflow-actions-native '" >> $GITHUB_OUTPUT
72+ echo " widgets=${all_widgets_and_js } " >> $GITHUB_OUTPUT
5273 fi
5374fi
5475
0 commit comments