Skip to content

Commit 0ee07f3

Browse files
committed
Fix conditionals & export TESTING_DEPTH for GHA
1 parent a151005 commit 0ee07f3

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

.github/workflows/build-check-install.yaml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ jobs:
540540
# Bash script run
541541
commit_msg=$( git log -1 --pretty=%B )
542542
543-
echo "Commit msg is ${commit_msg}"
543+
echo "Commit msg is: ${commit_msg}"
544544
# Exit early if tag is on commit message even if it set to true
545545
test_all=$( echo "${commit_msg}" | grep -zvF "[run-all-tests]" | tr -d '\0')
546546
@@ -552,7 +552,7 @@ jobs:
552552
553553
test_dir="tests/testthat/"
554554
555-
if [ -z "${ALL_CHANGED_FILES}" ]
555+
if [ -z "$ALL_CHANGED_FILES" ]
556556
then {
557557
echo "No R files affected: test everything."
558558
exit 0
@@ -572,12 +572,11 @@ jobs:
572572
td=$TESTING_DEPTH
573573
574574
# Modify in place so that only modified modules are tested.
575-
if [ -n "$test_files" ] && [ -n "$test_all" ];
575+
if [ -n "$test_files" ];
576576
then {
577577
sed -i 's/skip_if_too_deep(5)/skip_if_too_deep(3)/g' "$test_files"
578-
export TESTING_DEPTH="3"
578+
TESTING_DEPTH="3"
579579
echo "Testing with shinytest2 for $test_files";
580-
echo "Settin testing_depth=$TESTING_DEPTH"
581580
} else {
582581
# Flag for helpers
583582
helper_modified="yes"
@@ -590,9 +589,12 @@ jobs:
590589
if [ -n "$helper_modified" ] || [ -z "$test_all" ];
591590
then {
592591
echo "Skip step or helper modifications detected."
593-
export TESTING_DEPTH="$td";
592+
TESTING_DEPTH="$td";
594593
} fi
595594
done
595+
596+
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#setting-an-environment-variable
597+
echo "TESTING_DEPTH=${TESTING_DEPTH}" >> "$GITHUB_ENV"
596598
echo Using "TESTING_DEPTH=${TESTING_DEPTH}"
597599
shell: bash
598600

0 commit comments

Comments
 (0)