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