(files: GitHubCompareFiles)
| 198 | } |
| 199 | |
| 200 | function getTreeFiles(files: GitHubCompareFiles) { |
| 201 | const treeFiles = files.reduce((arr, file) => { |
| 202 | if (file.status === 'removed') { |
| 203 | // delete the file |
| 204 | arr.push({ sha: null, path: file.filename }); |
| 205 | } else if (file.status === 'renamed') { |
| 206 | // delete the previous file |
| 207 | arr.push({ sha: null, path: file.previous_filename as string }); |
| 208 | // add the renamed file |
| 209 | arr.push({ sha: file.sha, path: file.filename }); |
| 210 | } else { |
| 211 | // add the file |
| 212 | arr.push({ sha: file.sha, path: file.filename }); |
| 213 | } |
| 214 | return arr; |
| 215 | }, [] as TreeFileForUpdate[]); |
| 216 | |
| 217 | return treeFiles; |
| 218 | } |
| 219 | |
| 220 | export type Diff = { |
| 221 | path: string; |
no outgoing calls
no test coverage detected