@@ -543,9 +543,9 @@ jobs:
543543
544544 # Get the list of R files that have changed
545545 # https://github.com/cloudnativeto/envoy/blob/de67446fa8af973761bb4716f5143d73643baf8b/.github/workflows/get_build_targets.sh_bak#L9
546- files=$(git diff --name-only HEAD FETCH_HEAD -- $test_dir R/*.R)
546+ files=$(git diff --name-only main.. -- $test_dir R/*.R)
547547
548- if [ -n "$files" ]
548+ if [ -z "$files" ]
549549 then {
550550 echo "No R files affected: test everything."
551551 exit 0
@@ -554,6 +554,8 @@ jobs:
554554 # Loop through each modified file and determine which tests to run
555555 for file in $files; do
556556
557+ echo "Check for $file"
558+
557559 # Extract the base name of the file, examples:
558560 # tests/testthat/test-shinytest2-foo.R -> foo
559561 # R/foo.R -> foo
@@ -563,11 +565,12 @@ jobs:
563565 td=$TESTING_DEPTH
564566
565567 # Modify in place so that only modified modules are tested.
566- if [ -n "$test_files" ] && [ -z "$test_all" ];
568+ if [ -n "$test_files" ] && [ -n "$test_all" ];
567569 then {
568570 sed -i 's/skip_if_too_deep(5)/skip_if_too_deep(3)/g' "$test_files"
569- TESTING_DEPTH=3
571+ export TESTING_DEPTH="3"
570572 echo "Testing with shinytest2 for $test_files";
573+ echo "Settin testing_depth=$TESTING_DEPTH"
571574 } else {
572575 # Flag for helpers
573576 helper_modified="yes"
@@ -577,12 +580,13 @@ jobs:
577580 } fi
578581
579582 # R file without corresponding test file: reset the testing depth
580- if [ -n "$helper_modified" ] || [ -n "$test_all" ];
583+ if [ -n "$helper_modified" ] || [ -z "$test_all" ];
581584 then {
582585 echo "Skip step or helper modifications detected."
583- TESTING_DEPTH=$td;
586+ export TESTING_DEPTH=" $td" ;
584587 } fi
585588 done
589+ echo Using "TESTING_DEPTH=${TESTING_DEPTH}"
586590 shell : bash
587591
588592 - name : Build R package 🏗
0 commit comments