Skip to content

Commit 1ae26cc

Browse files
committed
fix: fetch target branch to get fallback tag in CI
1 parent 54269dc commit 1ae26cc

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

generation/run_generator_docker.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ if [[ "$CURRENT_BRANCH" =~ ^release-please-- ]]; then
4646
echo "Detected release PR branch: $CURRENT_BRANCH"
4747
if ! docker pull "${IMAGE_NAME}:${IMAGE_TAG}"; then
4848
echo "Image not found for version ${IMAGE_TAG}. Falling back to previous version from ${TARGET_BRANCH}."
49-
# Extract tag from target branch's versions.txt
50-
PREVIOUS_TAG=$(git show origin/"${TARGET_BRANCH}":versions.txt | grep "^gapic-generator-java:" | cut -d ':' -f 2 || true)
49+
# Extract tag from target branch's versions.txt using explicit fetch
50+
git fetch origin "${TARGET_BRANCH}" --depth=1 || true
51+
PREVIOUS_TAG=$(git show FETCH_HEAD:versions.txt | grep "^gapic-generator-java:" | cut -d ':' -f 2 || true)
5152
if [ -n "$PREVIOUS_TAG" ]; then
5253
echo "Using previous image version: $PREVIOUS_TAG"
5354
IMAGE_TAG="$PREVIOUS_TAG"

0 commit comments

Comments
 (0)