def try_create_connection()

in src/cli/utils/cicd.py [0:0]


    def try_create_connection() -> subprocess.CompletedProcess[str]:
        cmd = [
            "gcloud",
            "builds",
            "connections",
            "create",
            "github",
            connection_name,
            f"--region={region}",
            f"--project={project_id}",
        ]

        # Display the command being run
        console.print(f"\nšŸ”„ Running command: {' '.join(cmd)}")

        # Use Popen to get control over stdin
        process = subprocess.Popen(
            cmd,
            stdin=subprocess.PIPE,
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            text=True,
        )

        # Send 'y' followed by enter key to handle both the API enablement prompt and any other prompts
        stdout, stderr = process.communicate(input="y\n")

        # Create a CompletedProcess-like object for compatibility
        return subprocess.CompletedProcess(
            args=cmd, returncode=process.returncode, stdout=stdout, stderr=stderr
        )