Refactoring: Shorten print_project_pipeline(). (#638)

This commit moves all functionality related to validating configuration
changes into a separate function.
diff --git a/buildkite/bazelci.py b/buildkite/bazelci.py
index 59af243..066d676 100644
--- a/buildkite/bazelci.py
+++ b/buildkite/bazelci.py
@@ -1672,35 +1672,7 @@
         )
 
     if "validate_config" in configs:
-        output = execute_command_and_get_output(
-            [
-                "git",
-                "diff-tree",
-                "--no-commit-id",
-                "--name-only",
-                "-r",
-                os.getenv("BUILDKITE_COMMIT"),
-            ]
-        )
-        config_files = [
-            l
-            for l in output.split("\n")
-            if l.startswith(".bazelci/") and os.path.splitext(l)[1] in CONFIG_FILE_EXTENSIONS
-        ]
-        platform = DEFAULT_PLATFORM
-        for f in config_files:
-            pipeline_steps.append(
-                create_step(
-                    label=":cop: Validate {}".format(f),
-                    commands=[
-                        fetch_bazelcipy_command(),
-                        "{} bazelci.py project_pipeline --file_config={}".format(
-                            python_binary(platform), f
-                        ),
-                    ],
-                    platform=platform,
-                )
-            )
+        pipeline_steps += create_config_validation_steps()
 
     print(yaml.dump({"steps": pipeline_steps}))
 
@@ -1712,6 +1684,31 @@
     return task_config.get("platform", task)
 
 
+def create_config_validation_steps():
+    output = execute_command_and_get_output(
+        ["git", "diff-tree", "--no-commit-id", "--name-only", "-r", os.getenv("BUILDKITE_COMMIT")]
+    )
+    config_files = [
+        l
+        for l in output.split("\n")
+        if l.startswith(".bazelci/") and os.path.splitext(l)[1] in CONFIG_FILE_EXTENSIONS
+    ]
+    platform = DEFAULT_PLATFORM
+    return [
+        create_step(
+            label=":cop: Validate {}".format(f),
+            commands=[
+                fetch_bazelcipy_command(),
+                "{} bazelci.py project_pipeline --file_config={}".format(
+                    python_binary(platform), f
+                ),
+            ],
+            platform=platform,
+        )
+        for f in config_files
+    ]
+
+
 def runner_step(
     platform,
     task,