computer-scienceangular-roadmapbackend-roadmapblockchain-roadmapdba-roadmapdeveloper-roadmapdevops-roadmapfrontend-roadmapgo-roadmaphactoberfestjava-roadmapjavascript-roadmapnodejs-roadmappython-roadmapqa-roadmapreact-roadmaproadmapstudy-planvue-roadmapweb3-roadmap
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
905 B
33 lines
905 B
import { execSync } from 'child_process'; |
|
|
|
export const prerender = true; |
|
|
|
export async function GET() { |
|
const commitHash = execSync('git rev-parse HEAD').toString().trim(); |
|
const commitDate = execSync('git log -1 --format=%cd').toString().trim(); |
|
const commitMessage = execSync('git log -1 --format=%B').toString().trim(); |
|
|
|
const prevCommitHash = execSync('git rev-parse HEAD~1').toString().trim(); |
|
const prevCommitDate = execSync('git log -1 --format=%cd HEAD~1') |
|
.toString() |
|
.trim(); |
|
const prevCommitMessage = execSync('git log -1 --format=%B HEAD~1') |
|
.toString() |
|
.trim(); |
|
|
|
return new Response( |
|
JSON.stringify({ |
|
current: { |
|
hash: commitHash, |
|
date: commitDate, |
|
message: commitMessage, |
|
}, |
|
previous: { |
|
hash: prevCommitHash, |
|
date: prevCommitDate, |
|
message: prevCommitMessage, |
|
}, |
|
}), |
|
{}, |
|
); |
|
}
|
|
|