Skip to content

Commit 921f875

Browse files
committed
Changing defaults to run on all notebooks
1 parent d07602d commit 921f875

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

test.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,25 @@ notebook_files=()
77
all_markdown_files=$(find tutorials -type f -name "*.md")
88

99
if [ $# -gt 0 ]; then
10-
if [[ "$1" == all ]]; then
11-
files_to_process=$all_markdown_files
10+
echo "INFO: Testing only a subset of notebooks"
11+
if [[ "$1" == --changed ]]; then
12+
# We only want to run tests for the notebooks we touched compared to `branch`
13+
# provided in the second argument.
14+
branch=$2
15+
files_to_process=$(git fetch ${branch} --depth=1; git diff ${branch} --name-only tutorials | grep .md)
16+
1217
else
1318
files_to_process="$@"
1419
fi
1520

1621
else
17-
# We only want to run tests for the notebooks we touched
18-
files_to_process=$(git fetch origin main --depth=1; git diff origin/main --name-only tutorials | grep .md)
22+
echo "INFO: Testing all the notebooks"
23+
files_to_process=$all_markdown_files
24+
1925
fi
2026

2127
# Identify Markdown files that are Jupytext and convert them all.
2228
for file in ${files_to_process}; do
23-
echo loop in $file
2429
# Extract the kernel information from the Jupytext Markdown file.
2530
kernel_info=$(grep -A 10 '^---$' "$file" | grep -E 'kernelspec')
2631
# Skip if no kernel information was found.

0 commit comments

Comments
 (0)