Skip to content

Commit d0227ba

Browse files
Fix git version variable for docker compose. (#1191)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 8e7a85f commit d0227ba

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

astro.config.mjs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ import deleteUnusedImages from "astro-delete-unused-images";
1313
import preload from "astro-preload";
1414
import { execSync } from "node:child_process";
1515

16+
let gitVersion = "";
17+
try {
18+
gitVersion = execSync("git rev-parse --short HEAD 2>&1 > /dev/null");
19+
} catch (e) {}
20+
1621
// https://astro.build/config
1722
export default defineConfig({
1823
vite: {
@@ -21,9 +26,7 @@ export default defineConfig({
2126
.toISOString()
2227
.replace(/[-:T.Z]/g, "")
2328
.slice(0, 14),
24-
"import.meta.env.GIT_VERSION": new String(
25-
execSync("git rev-parse --short HEAD")
26-
),
29+
"import.meta.env.GIT_VERSION": new String(gitVersion),
2730
},
2831
resolve: {
2932
alias: {

0 commit comments

Comments
 (0)