( dir: string, commits: LocalCommit[] | PartialCommitResponse[] )
| 196 | } |
| 197 | |
| 198 | async function processDirectory( |
| 199 | dir: string, |
| 200 | commits: LocalCommit[] | PartialCommitResponse[] |
| 201 | ) { |
| 202 | try { |
| 203 | const packageObj = await ( |
| 204 | packageFileURL |
| 205 | ? readJson(packageFileURL) |
| 206 | : readJson(join(dir, packageFileName)) |
| 207 | ).catch(() => { |
| 208 | Promise.reject( |
| 209 | new NeutralExitError(`Package file not found: ${packageFileName}`) |
| 210 | ) |
| 211 | }) |
| 212 | |
| 213 | if (!isPackageObj(packageObj)) throw new Error("Can't find version field") |
| 214 | |
| 215 | if (commits.length >= 20) |
| 216 | warning( |
| 217 | 'This workflow run topped the commit limit set by GitHub webhooks: that means that commits could not appear and that the run could not find the version change.' |
| 218 | ) |
| 219 | |
| 220 | if (commits.length <= 0) { |
| 221 | info('There are no commits to look at.') |
| 222 | return |
| 223 | } |
| 224 | |
| 225 | await checkCommits(commits, packageObj.version) |
| 226 | } catch (e) { |
| 227 | setFailed(`${e}`) |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | async function checkCommits( |
| 232 | commits: LocalCommit[] | PartialCommitResponse[], |
no test coverage detected