Skip to content

Show last-built timestamp + linked commit SHA in footer#345

Open
sroertgen wants to merge 8 commits into
mainfrom
341-last-built-footer
Open

Show last-built timestamp + linked commit SHA in footer#345
sroertgen wants to merge 8 commits into
mainfrom
341-last-built-footer

Conversation

@sroertgen
Copy link
Copy Markdown
Contributor

@sroertgen sroertgen commented Apr 30, 2026

Summary

Adds Last built: YYYY-MM-DD HH:mm UTC (sha) to the footer, where the short SHA links to the commit on the configured repository host. Closes #341.

The motivation in the issue: CI logs sometimes report Error even on successful builds, so users (and the team) need a quick way to verify whether the deployed site reflects the latest source.

Implementation

  • src/buildInfo.js — pure helpers (formatBuildTime, shortSha, commitUrl), browser-safe, imported by the footer
  • src/resolveGitCommit.js — Node-only helper (kept separate so child_process doesn't get pulled into the browser bundle); resolves the SHA from GITHUB_SHACI_COMMIT_SHAgit rev-parse HEADnull. Uses dependency injection for execSync to keep tests fast and free of CJS/ESM mocking gymnastics.
  • gatsby-config.js — exposes gitCommit + repositoryUrl on siteMetadata (coerced to "" when missing, matching the existing customDomain: "" convention so Gatsby's automatic schema inference stays happy)
  • src/hooks/configAndConceptSchemes.js — also queries Gatsby's built-in site.buildTime
  • src/components/footer.jsx — renders four conditional shapes: Source link only, Source + timestamp, Source + timestamp + plain SHA (no repo URL), Source + timestamp + linked SHA. The footer no longer reads process.env.GATSBY_RESPOSITORY_URL directly — it gets repositoryUrl from the hook.

Note: the existing typo GATSBY_RESPOSITORY_URL (should be REPOSITORY) is preserved to avoid a breaking config change for existing deployments.

@sroertgen sroertgen force-pushed the 341-last-built-footer branch from d7c2ff8 to 54715c1 Compare April 30, 2026 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add "last built" information to HTML

1 participant