1
0
mirror of synced 2025-11-06 04:20:50 +08:00
Files
cook/scripts/git.ts
2025-10-07 18:51:48 +08:00

18 lines
326 B
TypeScript

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