MCPcopy Create free account
hub / github.com/EndBug/version-check / processDirectory

Function processDirectory

src/main.ts:198–229  ·  view source on GitHub ↗
(
  dir: string,
  commits: LocalCommit[] | PartialCommitResponse[]
)

Source from the content-addressed store, hash-verified

196}
197
198async 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
231async function checkCommits(
232 commits: LocalCommit[] | PartialCommitResponse[],

Callers 1

mainFunction · 0.70

Calls 7

warningFunction · 0.85
infoFunction · 0.85
setFailedFunction · 0.85
catchMethod · 0.80
readJsonFunction · 0.70
isPackageObjFunction · 0.70
checkCommitsFunction · 0.70

Tested by

no test coverage detected