mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
* fix: unicorn/no-empty-file * fix: unicorn/prefer-node-protocol * fix: unicorn/prefer-number-properties * fix: unicorn/consistent-destructuring * fix: unicorn/no-array-callback-reference * fix: unicorn/new-for-builtins * fix: set checkNaN to false in unicorn/prefer-number-properties * fix: unicorn/prefer-string-slice * fix: update eslint ignore
15 lines
458 B
TypeScript
15 lines
458 B
TypeScript
import { execSync } from 'node:child_process';
|
|
|
|
let gitHash = process.env.HEROKU_SLUG_COMMIT?.slice(0, 8) || process.env.VERCEL_GIT_COMMIT_SHA?.slice(0, 8);
|
|
let gitDate: Date | undefined;
|
|
if (!gitHash) {
|
|
try {
|
|
gitHash = execSync('git rev-parse HEAD').toString().trim().slice(0, 8);
|
|
gitDate = new Date(execSync('git log -1 --format=%cd').toString().trim());
|
|
} catch {
|
|
gitHash = 'unknown';
|
|
}
|
|
}
|
|
|
|
export { gitHash, gitDate };
|