Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ on:
push:
tags:
- '*'
workflow_dispatch:
Comment thread
m-Peter marked this conversation as resolved.
inputs:
version:
required: true
type: string

env:
DOCKER_IMAGE_URL: ${{ vars.REPO_DOCKER_IMAGE_URL }}
Expand All @@ -22,7 +27,7 @@ jobs:

- name: Set Gateway Version
id: set_version
run: echo "GATEWAY_VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo 'unknown')" >> $GITHUB_OUTPUT
run: echo "GATEWAY_VERSION=$(echo '${{ inputs.version }}' || git describe --tags --abbrev=0 2>/dev/null || echo 'unknown')" >> $GITHUB_OUTPUT

@coderabbitai coderabbitai Bot Sep 11, 2025

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.

⚠️ Potential issue

Broken fallback: echo always succeeds; tag builds will set an empty GATEWAY_VERSION.

echo '${{ inputs.version }}' || git describe ... never reaches the fallback because echo returns 0 even when empty. On tag pushes (no input) this yields an empty tag and will break Docker build/push.

Use an explicit emptiness check and prefer the event’s tag name when available:

-        run: echo "GATEWAY_VERSION=$(echo '${{ inputs.version }}' || git describe --tags --abbrev=0 2>/dev/null || echo 'unknown')" >> $GITHUB_OUTPUT
+        run: |
+          set -euo pipefail
+          ver="${{ inputs.version || '' }}"
+          # On tag pushes, GitHub exposes the tag as GITHUB_REF_NAME
+          if [ -z "$ver" ]; then
+            ver="${GITHUB_REF_NAME:-}"
+          fi
+          # Fallback to git describe if still empty (e.g., manual run without input)
+          if [ -z "$ver" ]; then
+            ver="$(git describe --tags --abbrev=0 2>/dev/null || true)"
+          fi
+          if [ -z "$ver" ]; then
+            echo "error: GATEWAY_VERSION could not be determined" >&2
+            exit 1
+          fi
+          echo "GATEWAY_VERSION=$ver" >> "$GITHUB_OUTPUT"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
run: echo "GATEWAY_VERSION=$(echo '${{ inputs.version }}' || git describe --tags --abbrev=0 2>/dev/null || echo 'unknown')" >> $GITHUB_OUTPUT
run: |
set -euo pipefail
ver="${{ inputs.version || '' }}"
# On tag pushes, GitHub exposes the tag as GITHUB_REF_NAME
if [ -z "$ver" ]; then
ver="${GITHUB_REF_NAME:-}"
fi
# Fallback to git describe if still empty (e.g., manual run without input)
if [ -z "$ver" ]; then
ver="$(git describe --tags --abbrev=0 2>/dev/null || true)"
fi
if [ -z "$ver" ]; then
echo "error: GATEWAY_VERSION could not be determined" >&2
exit 1
fi
echo "GATEWAY_VERSION=$ver" >> "$GITHUB_OUTPUT"
🤖 Prompt for AI Agents
In .github/workflows/build.yml around line 30, the current command uses "echo
'${{ inputs.version }}' || git describe ..." which always succeeds (even when
empty) and results in an empty GATEWAY_VERSION on tag builds; replace this with
a real emptiness check and an ordered fallback: use the workflow input if
non-empty, otherwise prefer the event/tag name (e.g. github.ref or the release
tag name when present), then fallback to git describe --tags --abbrev=0, and
finally 'unknown'; update the run step to compute the value with those explicit
conditionals and then append "GATEWAY_VERSION=..." to $GITHUB_OUTPUT so the
Docker build receives a non-empty version.

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.

@turbolent Is the AI here right? Have you tried this workflow? Or it needs merge first?

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.

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

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.

Update: It seems the AI is right indeed.


- name: Google auth
id: auth
Expand Down