Skip to content

Commit 6b77997

Browse files
roypatkalyazin
authored andcommitted
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 <roypat@amazon.co.uk>
1 parent 0649347 commit 6b77997

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
@@ -123,7 +123,7 @@ def run_all_tests(changed_files):
123123
return not changed_files or any(
124124
x.suffix != ".md"
125125
and not (x.parts[0] == ".github" and x.suffix == ".yml")
126-
and x.parts[1] != "hiding_ci"
126+
and (len(x.parts) < 2 or x.parts[1] != "hiding_ci")
127127
for x in changed_files
128128
)
129129

0 commit comments

Comments
 (0)