Skip to content

feat: stamp git commit SHA in builds#8

Merged
beeman merged 1 commit intomainfrom
obrera/build-stamp
Feb 18, 2026
Merged

feat: stamp git commit SHA in builds#8
beeman merged 1 commit intomainfrom
obrera/build-stamp

Conversation

@obrera
Copy link
Copy Markdown
Collaborator

@obrera obrera commented Feb 18, 2026

Stamps the git commit SHA into each build for traceability:

  • <meta name="x-commit"> in every page head (inspect element to see it)
  • /version.json with SHA, GitHub commit URL, and build timestamp
  • COMMIT_SHA build arg passed from CI → Docker → Astro

Quick check after deploy:

curl -s https://colmena.dev/version.json | jq

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @obrera, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the traceability of deployed applications by embedding the Git commit SHA directly into the build artifacts. This allows for easy identification of the exact code version running in any environment, both through a visible meta tag in the page head and a dedicated /version.json endpoint.

Highlights

  • Build Traceability: Implemented stamping of the Git commit SHA into every build for improved traceability.
  • Page Metadata: Added a tag to the head of all pages, displaying the commit SHA.
  • Version Endpoint: Created a new /version.json endpoint that provides the commit SHA, its GitHub URL, and the build timestamp.
  • CI/CD Integration: Configured the build process to pass the COMMIT_SHA as a build argument from CI to Docker and then to Astro.
Changelog
  • Dockerfile
    • Introduced a COMMIT_SHA build argument with a default value of 'unknown'.
    • Modified the bun run build command to pass the COMMIT_SHA environment variable.
  • astro.config.mjs
    • Imported the new buildStamp integration.
    • Defined commitSha by reading process.env.COMMIT_SHA or defaulting to 'dev'.
    • Added a tag to the Starlight integration's head configuration, using the commitSha.
    • Registered the buildStamp() integration.
  • src/integrations/build-stamp.ts
    • Added a new file defining an Astro integration named build-stamp.
    • This integration hooks into astro:build:done to write a version.json file.
    • The version.json file contains the commit SHA, a GitHub commit URL (if SHA is not 'dev'), and the build timestamp.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/docker.yml
Activity
  • No human activity has been recorded for this pull request.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request implements a mechanism to stamp the git commit SHA into builds for better traceability, exposing it via a meta tag and a version.json endpoint. A critical security concern has been identified: the Dockerfile contains a potential shell injection vulnerability where the COMMIT_SHA build argument is used unquoted in a RUN instruction, which could allow arbitrary command execution during the build process. Additionally, it is suggested to make the new build-stamp integration configurable to improve reusability and centralize its configuration.

Comment thread Dockerfile Outdated
Comment thread src/integrations/build-stamp.ts Outdated
@obrera obrera force-pushed the obrera/build-stamp branch from 2f4271e to 8e8cfe7 Compare February 18, 2026 13:54
@beeman beeman merged commit 724e871 into main Feb 18, 2026
1 check passed
@beeman beeman deleted the obrera/build-stamp branch February 18, 2026 14: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.

2 participants