Skip to content

feat: X-Git-Sha response header with the deployed commit - #496

Merged
saqibmanan merged 1 commit into
devfrom
feat/git-sha-header
Oct 7, 2026
Merged

saqibmanan merged 1 commit into
devfrom
feat/git-sha-header

Conversation

@saqibmanan

Copy link
Copy Markdown
Contributor

Why

CivicDataSpace-test's deployed_pr gate needs to know which frontend commit is live, so tests for a merged PR run only once it's actually deployed. The frontend has no equivalent of the backend's /health/ git_sha. Inferring it from the GitHub workflow-runs API failed: during some windows, lasting a minute or more, that endpoint returns a weeks-old run list.

Change

next.config.mjs headers() adds X-Git-Sha: <GITHUB_SHA> on every path when the build has GITHUB_SHA, which GitHub Actions always sets. The existing X-Robots-Tag logic is unchanged.

The value is fixed at build time, so each release under releases/ reports its own commit, and a rollback reports the commit actually being served.

Verified (local next build + next start)

build runtime headers on /en
prod-like (FEATURE_SITEMAPS='true'), GITHUB_SHA=111… no GITHUB_SHA X-Git-Sha: 111…, no X-Robots-Tag
dev-like ('false'), GITHUB_SHA=222… GITHUB_SHA=9999 X-Git-Sha: 222…, X-Robots-Tag: noindex, nofollow

The commit SHA is already public for the backend via /health/.

Lets the test suite tell which commit is live on dev and prod, like the
backend's /health/ git_sha. Baked at build time from GITHUB_SHA, so a
rolled-back release reports its own commit.
@saqibmanan
saqibmanan deployed to development October 7, 2026 13:02 — with GitHub Actions Active
@saqibmanan
saqibmanan merged commit 4a46666 into dev Oct 7, 2026
2 checks passed

This branch was successfully deployed

1 active deployment
development — 808f8652 Deployed Oct 7, 2026 by saqibmanan via build (24.x) #842
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.

1 participant