func getFilesChanged()

in scripts/lint_prowjobs/main.go [195:209]


func getFilesChanged(gitRoot, pullBaseSha, pullPullSha string) ([]string, error) {
	presubmitFiles := []string{}
	gitDiffCommand := []string{"git", "-C", gitRoot, "diff", "--name-only", pullBaseSha, pullPullSha}
	fmt.Println("\n", strings.Join(gitDiffCommand, " "))

	gitDiffOutput, err := exec.Command("git", gitDiffCommand[1:]...).Output()

	filesChanged := strings.Fields(string(gitDiffOutput))
	for _, file := range filesChanged {
		if strings.Contains(file, "presubmits") && strings.HasPrefix(file, "jobs") && strings.HasSuffix(file, "yaml") {
			presubmitFiles = append(presubmitFiles, file)
		}
	}
	return presubmitFiles, err
}