Skip to content

Commit eb66c2b

Browse files
authored
Merge pull request #646 from github/feature/footer-commit-info
Add commit SHA and build date to website footer
2 parents 612f5e4 + f4c2e0b commit eb66c2b

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

website/public/styles/global.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,12 @@ a:hover {
688688
color: var(--color-accent);
689689
}
690690

691+
.site-footer .build-info {
692+
margin-top: 8px;
693+
font-size: 12px;
694+
opacity: 0.7;
695+
}
696+
691697
/* Buttons */
692698
.btn {
693699
display: inline-flex;

website/src/layouts/BaseLayout.astro

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
---
2+
import { execSync } from "child_process";
3+
24
interface Props {
35
title: string;
46
description?: string;
@@ -11,6 +13,21 @@ const {
1113
activeNav = "",
1214
} = Astro.props;
1315
const base = import.meta.env.BASE_URL;
16+
17+
// Get git commit SHA and build date at build time
18+
let commitSha = "unknown";
19+
let buildDate = new Date().toISOString().split("T")[0];
20+
try {
21+
// Use GITHUB_SHA env var in GitHub Actions, fallback to git command locally
22+
const githubSha = process.env.GITHUB_SHA;
23+
if (githubSha) {
24+
commitSha = githubSha.substring(0, 7);
25+
} else {
26+
commitSha = execSync("git rev-parse --short HEAD", { encoding: "utf-8" }).trim();
27+
}
28+
} catch {
29+
// Fallback if git is not available
30+
}
1431
---
1532

1633
<!doctype html>
@@ -155,6 +172,13 @@ const base = import.meta.env.BASE_URL;
155172
rel="noopener">MIT License</a
156173
>
157174
</p>
175+
<p class="build-info">
176+
Built from <a
177+
href={`https://github.com/github/awesome-copilot/commit/${commitSha}`}
178+
target="_blank"
179+
rel="noopener">{commitSha}</a
180+
> on {buildDate}
181+
</p>
158182
</div>
159183
</footer>
160184

0 commit comments

Comments
 (0)