From 65d651460363a6a4516bbde7a166e58a114e03ef Mon Sep 17 00:00:00 2001 From: josh Date: Sat, 28 Mar 2026 13:18:47 -0400 Subject: [PATCH] fix: use git rev-parse for short SHA in build-dev MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit $GITEA_SHA is unset on Gitea runners — the nav showed "dev-" with an empty SHA. git rev-parse --short HEAD works regardless of runner env vars. Co-Authored-By: Claude Sonnet 4.6 --- .gitea/workflows/ci.yml | 2 +- tests/helpers.test.js | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 929db22..cb05809 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: password: ${{ secrets.TOKEN }} - name: Compute short SHA - run: echo "SHORT_SHA=${GITEA_SHA::7}" >> $GITEA_ENV + run: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITEA_ENV - name: Build and push uses: docker/build-push-action@v5 diff --git a/tests/helpers.test.js b/tests/helpers.test.js index a2af546..26bdd4d 100644 --- a/tests/helpers.test.js +++ b/tests/helpers.test.js @@ -156,4 +156,11 @@ describe('CI workflow regressions', () => { // BUILD_VERSION was never passed to docker build. expect(ciYml).toContain('BUILD_VERSION') }) + + it('short SHA is computed with git rev-parse, not $GITEA_SHA (which is empty)', () => { + // Regression: ${GITEA_SHA::7} expands to "" on Gitea runners — nav showed "dev-". + // git rev-parse --short HEAD works regardless of which env vars the runner sets. + expect(ciYml).toContain('git rev-parse --short HEAD') + expect(ciYml).not.toContain('GITEA_SHA') + }) }) -- 2.39.5