mirror of
https://github.com/github/awesome-copilot.git
synced 2026-02-20 02:15:12 +00:00
Add commit SHA and build date to website footer
- Display short commit SHA with link to GitHub commit - Show build date in YYYY-MM-DD format - Use GITHUB_SHA env var in CI, fallback to git command locally - Add subtle styling for build info text
This commit is contained in:
@@ -688,6 +688,12 @@ a:hover {
|
||||
color: var(--color-accent);
|
||||
}
|
||||
|
||||
.site-footer .build-info {
|
||||
margin-top: 8px;
|
||||
font-size: 12px;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
/* Buttons */
|
||||
.btn {
|
||||
display: inline-flex;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
---
|
||||
import { execSync } from "child_process";
|
||||
|
||||
interface Props {
|
||||
title: string;
|
||||
description?: string;
|
||||
@@ -11,6 +13,21 @@ const {
|
||||
activeNav = "",
|
||||
} = Astro.props;
|
||||
const base = import.meta.env.BASE_URL;
|
||||
|
||||
// Get git commit SHA and build date at build time
|
||||
let commitSha = "unknown";
|
||||
let buildDate = new Date().toISOString().split("T")[0];
|
||||
try {
|
||||
// Use GITHUB_SHA env var in GitHub Actions, fallback to git command locally
|
||||
const githubSha = process.env.GITHUB_SHA;
|
||||
if (githubSha) {
|
||||
commitSha = githubSha.substring(0, 7);
|
||||
} else {
|
||||
commitSha = execSync("git rev-parse --short HEAD", { encoding: "utf-8" }).trim();
|
||||
}
|
||||
} catch {
|
||||
// Fallback if git is not available
|
||||
}
|
||||
---
|
||||
|
||||
<!doctype html>
|
||||
@@ -155,6 +172,13 @@ const base = import.meta.env.BASE_URL;
|
||||
rel="noopener">MIT License</a
|
||||
>
|
||||
</p>
|
||||
<p class="build-info">
|
||||
Built from <a
|
||||
href={`https://github.com/github/awesome-copilot/commit/${commitSha}`}
|
||||
target="_blank"
|
||||
rel="noopener">{commitSha}</a
|
||||
> on {buildDate}
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user