Show last-built timestamp + linked commit SHA in footer#345
Open
sroertgen wants to merge 8 commits into
Open
Conversation
d7c2ff8 to
54715c1
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Erroreven 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 footersrc/resolveGitCommit.js— Node-only helper (kept separate sochild_processdoesn't get pulled into the browser bundle); resolves the SHA fromGITHUB_SHA→CI_COMMIT_SHA→git rev-parse HEAD→null. Uses dependency injection forexecSyncto keep tests fast and free of CJS/ESM mocking gymnastics.gatsby-config.js— exposesgitCommit+repositoryUrlonsiteMetadata(coerced to""when missing, matching the existingcustomDomain: ""convention so Gatsby's automatic schema inference stays happy)src/hooks/configAndConceptSchemes.js— also queries Gatsby's built-insite.buildTimesrc/components/footer.jsx— renders four conditional shapes:Sourcelink only,Source+ timestamp,Source+ timestamp + plain SHA (no repo URL),Source+ timestamp + linked SHA. The footer no longer readsprocess.env.GATSBY_RESPOSITORY_URLdirectly — it getsrepositoryUrlfrom the hook.Note: the existing typo
GATSBY_RESPOSITORY_URL(should beREPOSITORY) is preserved to avoid a breaking config change for existing deployments.