Skip to content

Commit 668d131

Browse files
committed
Improving check to run workflows
Aside from checking bazel targets, we also need to check if there are any test targets we need to run. For example, a change in Grid needs to trigger remote tests in all bindings.
1 parent a5204d4 commit 668d131

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

scripts/github-actions/should-workflow-run.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,19 @@ fi
3131

3232
if [[ " ${bazel_targets[*]} " == *"$BAZEL_TARGET_PREFIX"* ]]; then
3333
echo "::set-output name=run-workflow::true"
34-
echo "Bazel targets found: ${bazel_targets[*]}."
34+
echo "Bazel targets found: ${bazel_targets[*]}"
35+
exit 0
3536
fi
3637

38+
# Now check if we need to run some tests based on this change
39+
# E.g. A change in Grid needs to trigger remote tests in other bindings
40+
tests=$(bazel query \
41+
--keep_going \
42+
--noshow_progress \
43+
"kind(test, rdeps(//..., set(${bazel_targets[*]})))")
3744

38-
45+
if [[ " ${tests[*]} " == *"$BAZEL_TARGET_PREFIX"* ]]; then
46+
echo "::set-output name=run-workflow::true"
47+
echo "Test targets found: ${tests[*]}"
48+
exit 0
49+
fi

0 commit comments

Comments
 (0)