(files: GitHubCompareFiles)
| 173 | } |
| 174 | |
| 175 | function getTreeFiles(files: GitHubCompareFiles) { |
| 176 | const treeFiles = files.reduce((arr, file) => { |
| 177 | if (file.status === 'removed') { |
| 178 | // delete the file |
| 179 | arr.push({ sha: null, path: file.filename }); |
| 180 | } else if (file.status === 'renamed') { |
| 181 | // delete the previous file |
| 182 | arr.push({ sha: null, path: file.previous_filename as string }); |
| 183 | // add the renamed file |
| 184 | arr.push({ sha: file.sha, path: file.filename }); |
| 185 | } else { |
| 186 | // add the file |
| 187 | arr.push({ sha: file.sha, path: file.filename }); |
| 188 | } |
| 189 | return arr; |
| 190 | }, [] as TreeFileForUpdate[]); |
| 191 | |
| 192 | return treeFiles; |
| 193 | } |
| 194 | |
| 195 | export type Diff = { |
| 196 | path: string; |
no outgoing calls
no test coverage detected