Skip to content

Commit 287d5f4

Browse files
committed
fix(ci): do not crash if file in repo root is modified
by unconditionally grabbing the second part of the path of a modified file in `run_all_tests()`, we ended up indexing out of bounds if a modified file does not _have_ a second component in its path (e.g. if the file is at the repository root, like `Cargo.lock`). Fix this by checking for the length of x.parts first, and using python's short-circuiting behavior of logical operators. Signed-off-by: Patrick Roy <[email protected]>
1 parent 7fcad13 commit 287d5f4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

.buildkite/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def run_all_tests(changed_files):
126126
return not changed_files or any(
127127
x.suffix != ".md"
128128
and not (x.parts[0] == ".github" and x.suffix == ".yml")
129-
and x.parts[1] != "hiding_ci"
129+
and (len(x.parts) < 2 or x.parts[1] != "hiding_ci")
130130
for x in changed_files
131131
)
132132

0 commit comments

Comments
 (0)