File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -515,6 +515,37 @@ jobs:
515515 path : " ${{ inputs.additional-caches }}"
516516 key : additional-caches-${{ runner.os }}
517517
518+ - name : Check only affected modules
519+ if : startsWith(${{ github.event.repository.name }}, "teal.modules.") && github.event_name == 'pull_request'
520+ run : |
521+ # Get the list of files that have changed
522+ files=$(git diff --name-only main..)
523+
524+ # Base directories
525+ src_dir="R/"
526+ test_dir="tests/testthat/"
527+
528+ # Loop through each modified file and determine which tests to run
529+ for file in $files; do
530+
531+ # Extract the base name of the file, examples:
532+ # tests/testthat/test-shinytest2-foo.R -> foo
533+ # R/foo.R -> foo
534+ base_name=$(basename "$file" .R | sed s/test-shinytest2-//g)
535+
536+ # Find matching test files
537+ test_files=$(grep -l "$base_name" "$test_dir"test-shinytest2-*.R)
538+
539+ if [ -z "$test_files" ]; then
540+ echo "No test files found for modified file about $base_name."
541+ else
542+ echo "${file} matches ${test_files}"
543+ sed -i 's/skip_if_too_deep(5)/skip_if_too_deep(3)/g' "$test_files"
544+ fi
545+ done
546+ TESTING_DEPTH=3
547+ shell : bash
548+
518549 - name : Build R package 🏗
519550 run : |
520551 if [ "${{ inputs.additional-env-vars }}" != "" ]
You can’t perform that action at this time.
0 commit comments