diff --git a/.kokoro/samples-test.sh b/.kokoro/samples-test.sh index 8c5d108cb..acad993f0 100755 --- a/.kokoro/samples-test.sh +++ b/.kokoro/samples-test.sh @@ -49,6 +49,12 @@ if [ -f samples/package.json ]; then $KOKORO_GFILE_DIR/linux_amd64/flakybot } trap cleanup EXIT HUP + else + # Check if there are any changes in the "samples" directory only for presubmits. + if git diff --quiet HEAD~1 HEAD -- samples/; then + echo "No changes detected in the samples directory. Skipping sample tests." + exit 0 + fi fi npm run samples-test diff --git a/owlbot.py b/owlbot.py index b61994e30..d3f2ea272 100644 --- a/owlbot.py +++ b/owlbot.py @@ -64,7 +64,7 @@ common_templates = gcp.CommonTemplates() templates = common_templates.node_library(source_location='build/src') -s.copy(templates) +s.copy(templates, excludes=[".kokoro/samples-test.sh"]) node.postprocess_gapic_library_hermetic()