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

Function checkCommits

src/main.ts:231–311  ·  view source on GitHub ↗
(
  commits: LocalCommit[] | PartialCommitResponse[],
  version: string
)

Source from the content-addressed store, hash-verified

229}
230
231async function checkCommits(
232 commits: LocalCommit[] | PartialCommitResponse[],
233 version: string
234) {
235 try {
236 startGroup(
237 `Searching in ${commits.length} commit${
238 commits.length == 1 ? '' : 's'
239 }...`
240 )
241 info(`Package file name: "${packageFileName}"`)
242 info(
243 `Package file URL: ${
244 packageFileURL ? `"${packageFileURL}"` : 'undefined'
245 }`
246 )
247 info(
248 `Version assumptions: ${
249 assumeSameVersion ? `"${assumeSameVersion}"` : 'undefined'
250 }`
251 )
252 for (const commit of commits) {
253 const { message, sha } = getBasicInfo(commit)
254 const match: string[] = message.match(semverReGlobal) || []
255 if (match.includes(version)) {
256 if (await checkDiff(sha, version)) {
257 endGroup()
258 info(
259 `Found match for version ${version}: ${sha.substring(
260 0,
261 7
262 )} ${message}`
263 )
264 return true
265 }
266 }
267 }
268 endGroup()
269
270 if (getBooleanInput('diff-search')) {
271 info(
272 'No standard npm version commit found, switching to diff search (this could take more time...)'
273 )
274
275 if (!isLocalCommitArray(commits)) {
276 commits = commits.sort(
277 (a, b) =>
278 new Date(b.commit.committer.date).getTime() -
279 new Date(a.commit.committer.date).getTime()
280 )
281 }
282
283 startGroup(
284 `Checking the diffs of ${commits.length} commit${
285 commits.length == 1 ? '' : 's'
286 }...`
287 )
288 for (const commit of commits) {

Callers 1

processDirectoryFunction · 0.70

Calls 10

startGroupFunction · 0.85
infoFunction · 0.85
endGroupFunction · 0.85
getBooleanInputFunction · 0.85
setFailedFunction · 0.85
getBasicInfoFunction · 0.70
checkDiffFunction · 0.70
isLocalCommitArrayFunction · 0.70
outputFunction · 0.70
matchMethod · 0.45

Tested by

no test coverage detected