From 4a19470d7b784f4292c7f5948a34656acc6cebf7 Mon Sep 17 00:00:00 2001 From: surbhigarg92 Date: Mon, 21 Oct 2024 23:16:28 +0530 Subject: [PATCH] chore: Remove presubmit for sample tests if no change identified (#2169) --- .kokoro/samples-test.sh | 6 ++++++ owlbot.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) 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()