Files
cook/scripts/git.ts
2025-08-17 03:28:50 +08:00

18 lines
324 B
TypeScript

import { simpleGit } from 'simple-git'
const git = simpleGit()
/**
* get git repo latest commit
*/
export async function getLatestCommit() {
try {
const log = await git.log({ maxCount: 1 })
return log.latest
}
catch (error) {
console.error('Error fetching latest commit:', error)
return null
}
}