def filter_samples(sample_dirs, changed_files):
    """Filers the list of sample directories to only include directories that
    contain changed files."""
    result = []
    for sample_dir in sample_dirs:
        if sample_dir.startswith('./'):
            sample_dir = sample_dir[2:]
        for changed_file in changed_files:
            if changed_file.startswith(sample_dir):
                result.append(sample_dir)

    return list(set(result))