Skip to content

www: show deployed commit hash in footer across production and staging builds#7258

Merged
PavelVanecek merged 4 commits into
mainfrom
copilot/add-commit-hash-footer
Apr 19, 2026
Merged

www: show deployed commit hash in footer across production and staging builds#7258
PavelVanecek merged 4 commits into
mainfrom
copilot/add-commit-hash-footer

Conversation

Copilot AI commented Apr 19, 2026

Copy link
Copy Markdown
Contributor
  • Replace git rev-parse HEAD with ${{ github.event.pull_request.head.sha || github.sha }} in the website build step so the displayed commit hash matches the PR branch tip, not the ephemeral merge commit

Copilot AI linked an issue Apr 19, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Add commit hash to website footer www: show deployed commit hash in footer Apr 19, 2026
Copilot AI requested a review from PavelVanecek April 19, 2026 02:00
@PavelVanecek
PavelVanecek marked this pull request as ready for review April 19, 2026 02:11
@codecov

codecov Bot commented Apr 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.07%. Comparing base (b4e4977) to head (5709859).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
www/src/layouts/Frame.tsx 85.71% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7258      +/-   ##
==========================================
- Coverage   89.07%   89.07%   -0.01%     
==========================================
  Files         538      538              
  Lines       41006    41020      +14     
  Branches     5557     5563       +6     
==========================================
+ Hits        36526    36538      +12     
- Misses       4472     4474       +2     
  Partials        8        8              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

Copy link
Copy Markdown
Contributor

Staging Deployment Details

These deployments will remain available for 30 days.

To update snapshots: Comment /update-snapshots on this PR to automatically update the baseline screenshots.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds deployment traceability to the www docs site by exposing the deployed git commit hash (short form) in the footer, and wires the deploy workflow to pass the commit SHA into the Vite build.

Changes:

  • Add getShortCommitHash() and conditionally render a Commit: line in Frame when VITE_RECHARTS_COMMIT_HASH is present.
  • Wire the website deploy workflow to pass GITHUB_SHA into the website build as VITE_RECHARTS_COMMIT_HASH.
  • Add Vitest unit coverage for hash trimming/shortening and empty/undefined handling.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
www/src/layouts/Frame.tsx Adds commit-hash normalization helper and renders the deployed commit in the footer.
www/test/layouts/Frame.spec.tsx Adds unit tests for commit hash trimming and 8-char truncation behavior.
.github/workflows/deploy-website.yml Passes a commit SHA into the website build as a Vite env var for footer display.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread www/src/layouts/Frame.tsx
Comment on lines +17 to +25
export function getShortCommitHash(commitHash: string | undefined): string | undefined {
const cleanedHash = commitHash?.trim();

if (!cleanedHash) {
return undefined;
}

return cleanedHash.slice(0, 8);
}

Copilot AI Apr 19, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getShortCommitHash is a pure string utility but it lives in Frame.tsx, which also has CSS side-effect imports and UI dependencies. This couples unit tests (and any future reuse) to the whole layout module and can slow/complicate testing/bundling. Consider moving this helper to a small utils module (e.g. www/src/utils/commitHash.ts) and importing it from both Frame and the test.

Copilot uses AI. Check for mistakes.
Comment thread www/src/layouts/Frame.tsx
Comment on lines +53 to +55
<p>
Commit: <code title={fullCommitHash}>{shortCommitHash}</code>
</p>

Copilot AI Apr 19, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The displayed hash is trimmed, but the tooltip uses the untrimmed fullCommitHash. If the env var ever includes surrounding whitespace, the tooltip and displayed value will disagree. Consider using the same cleaned value for the title (or trimming fullCommitHash before passing it through).

Copilot uses AI. Check for mistakes.
- name: Build website
working-directory: www
run: VITE_RECHARTS_LATEST_VERSION=`curl -X GET "https://registry.npmjs.org/recharts/latest" | jq --raw-output '.version'` npm run build
run: VITE_RECHARTS_LATEST_VERSION=`curl -X GET "https://registry.npmjs.org/recharts/latest" | jq --raw-output '.version'` VITE_RECHARTS_COMMIT_HASH=${GITHUB_SHA} npm run build

Copilot AI Apr 19, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VITE_RECHARTS_COMMIT_HASH=${GITHUB_SHA} may not always reflect the commit actually checked out/built (notably for workflow_run, where the desired revision is often github.event.workflow_run.head_sha, and more generally if the checkout ref changes). To guarantee the footer shows the deployed revision, consider deriving the hash from the checked-out repo (e.g. git rev-parse HEAD) or explicitly using the workflow_run head SHA.

Suggested change
run: VITE_RECHARTS_LATEST_VERSION=`curl -X GET "https://registry.npmjs.org/recharts/latest" | jq --raw-output '.version'` VITE_RECHARTS_COMMIT_HASH=${GITHUB_SHA} npm run build
run: VITE_RECHARTS_LATEST_VERSION=`curl -X GET "https://registry.npmjs.org/recharts/latest" | jq --raw-output '.version'` VITE_RECHARTS_COMMIT_HASH=$(git rev-parse HEAD) npm run build

Copilot uses AI. Check for mistakes.
@codecov

codecov Bot commented Apr 19, 2026

Copy link
Copy Markdown

Bundle Report

Bundle size has no change ✅

@PavelVanecek PavelVanecek left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The staging deployment doesn't show the commit hash. Please check if there's one more CI script that needs an update.

Copilot AI commented Apr 19, 2026

Copy link
Copy Markdown
Contributor Author

The staging deployment doesn't show the commit hash. Please check if there's one more CI script that needs an update.

Updated CI staging/canary website build to pass the commit hash env var too (VITE_RECHARTS_COMMIT_HASH=$(git rev-parse HEAD) in .github/workflows/ci.yml). This is in commit 5bb8789, so staging deployments should now show the footer hash.

Screenshot: https://github.com/user-attachments/assets/f03a20e8-8208-466f-af4e-8df99f0b4c38

Copilot AI changed the title www: show deployed commit hash in footer www: show deployed commit hash in footer across production and staging builds Apr 19, 2026
Copilot AI requested a review from PavelVanecek April 19, 2026 04:35
@github-actions

Copy link
Copy Markdown
Contributor

Staging Deployment Details

These deployments will remain available for 30 days.

To update snapshots: Comment /update-snapshots on this PR to automatically update the baseline screenshots.

@github-actions

Copy link
Copy Markdown
Contributor

Staging Deployment Details

These deployments will remain available for 30 days.

To update snapshots: Comment /update-snapshots on this PR to automatically update the baseline screenshots.

@PavelVanecek
PavelVanecek merged commit 0f9fb4d into main Apr 19, 2026
56 of 57 checks passed
@PavelVanecek
PavelVanecek deleted the copilot/add-commit-hash-footer branch April 19, 2026 13:46
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 commit hash to website footer

3 participants