forked from craws/OpenAtlas-Discovery
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
61d9c37
commit 2fe9839
Showing
2 changed files
with
27 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { execSync } from "node:child_process"; | ||
|
||
import { log } from "@acdh-oeaw/lib"; | ||
|
||
export function getGitInfo() { | ||
try { | ||
const branchName = execSync("git rev-parse --abbrev-ref HEAD").toString().trimEnd(); | ||
const commitHash = execSync("git rev-parse HEAD").toString().trimEnd(); | ||
const tag = execSync("git describe --always --tags").toString().trimEnd(); | ||
|
||
return { | ||
branchName, | ||
commitHash, | ||
tag, | ||
}; | ||
} catch (error) { | ||
log.error("Failed to get git info, using fallback values."); | ||
|
||
return { | ||
branchName: "development", | ||
commitHash: "", | ||
tag: "", | ||
}; | ||
} | ||
} |