Skip to content

Replace shadow-git-inject with GitHub Actions commit hash injection#4

Draft
Copilot wants to merge 7 commits intomainfrom
copilot/fix-git-version-tag-display
Draft

Replace shadow-git-inject with GitHub Actions commit hash injection#4
Copilot wants to merge 7 commits intomainfrom
copilot/fix-git-version-tag-display

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 11, 2025

The footer displays "git-version-tag-not-found" when shadow-git-inject cannot find version tags in the repository. This PR replaces the shadow-git-inject dependency with a simpler approach where GitHub Actions directly injects the commit hash during build.

Changes

  • Remove shadow-git-inject: Removed the day8/shadow-git-inject dependency and build hooks from shadow-cljs.edn
  • Environment variable injection: Configure shadow-cljs to read version from GIT_COMMIT_HASH environment variable with a default of "dev" for local builds
  • GitHub Actions integration: Update workflow to pass commit hash via ${{ github.sha }}
  • Simplified code: Removed fallback logic from footer-version function - no longer needed
  • CI configuration: Bump actions/checkout from v2 to v4
  • Documentation: Update README to reflect the simpler versioning approach, remove VERSION_SETUP.md
;; Before: Complex fallback logic for shadow-git-inject
(def ^:private fallback-versions #{"git-version-tag-not-found" "git-command-not-found" "unknown"})

(defn footer-version []
  (let [display-version (if (contains? fallback-versions config/version)
                           "development build"
                           config/version)]
    [:div "Git version: " display-version]))

;; After: Direct display of injected commit hash
(defn footer-version []
  [:div "Git version: " config/version])

How It Works

  • Production builds (GitHub Actions): Displays the full 40-character commit SHA (e.g., c6444d6a7f8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d)
  • Local development builds: Displays "dev"
  • No git tags required: Version is injected directly via environment variable

This approach is simpler, more reliable, and removes the dependency on git tags or external libraries.

Original prompt

at the bottom of the page it says "git version:" but it says "git-version-tag-not-found" instead of something useful


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI self-assigned this Dec 11, 2025
Copilot AI and others added 5 commits December 11, 2025 11:13
Co-authored-by: aeone <321090+aeone@users.noreply.github.com>
Co-authored-by: aeone <321090+aeone@users.noreply.github.com>
Co-authored-by: aeone <321090+aeone@users.noreply.github.com>
Co-authored-by: aeone <321090+aeone@users.noreply.github.com>
Co-authored-by: aeone <321090+aeone@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix git version tag display on the page Replace "git-version-tag-not-found" error with user-friendly fallback Dec 11, 2025
Copilot AI requested a review from aeone December 11, 2025 11:21
@aeone
Copy link
Copy Markdown
Owner

aeone commented Dec 11, 2025

@copilot What if instead of this we have our own setup where github actions can inject the commit hash in a way that it gets displayed in the relevant place in the website?

Co-authored-by: aeone <321090+aeone@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Dec 11, 2025

@copilot What if instead of this we have our own setup where github actions can inject the commit hash in a way that it gets displayed in the relevant place in the website?

Done! I've replaced shadow-git-inject with a simpler GitHub Actions approach (commit c6444d6).

Changes:

  • Removed shadow-git-inject dependency
  • GitHub Actions now passes commit hash via ${{ github.sha }}
  • Shadow-cljs reads from GIT_COMMIT_HASH environment variable
  • Local builds show "dev", CI builds show full commit SHA
  • Removed 66 lines of unnecessary code

Result:

  • Production: Git version: c6444d6a7f8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d
  • Local dev: Git version: dev

Copilot AI changed the title Replace "git-version-tag-not-found" error with user-friendly fallback Replace shadow-git-inject with GitHub Actions commit hash injection Dec 11, 2025
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