From 8e47e2d9dfda41a2b5d298a611b28466e6474399 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 3 Mar 2026 15:23:28 +0000 Subject: [PATCH] fix: correct awk range to stop redis-exporter version loop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The awk range pattern /^metrics:/,/^[a-z]+:/ was broken because "metrics:" matches BOTH the start and end patterns simultaneously. In awk, when both patterns match the same line, the range opens and closes immediately — so the body never runs and CURRENT is always empty. Since any real version != "", the workflow always detected a "new update" for redis-exporter, creating the same PR on every run. Two bugs fixed: - Replace the broken range with a flag-based approach (found=1; next) that skips the "metrics:" line before checking the exit condition. - Replace /^\s+tag:/ with /^ +tag:/ since \s is not POSIX awk. https://claude.ai/code/session_01MDiuwf2FT7zd7aqGhTBuCL --- .github/workflows/update-valkey-version.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-valkey-version.yml b/.github/workflows/update-valkey-version.yml index d632896..cec9c09 100644 --- a/.github/workflows/update-valkey-version.yml +++ b/.github/workflows/update-valkey-version.yml @@ -75,8 +75,12 @@ jobs: - name: Get current redis-exporter version from values.yaml id: current-exporter-version run: | - # Extract tag from metrics section (more robust method) - CURRENT=$(awk '/^metrics:/,/^[a-z]+:/ {if (/^\s+tag:/) {print $2; exit}}' values.yaml | tr -d '"') + # Extract tag from metrics section. + # Note: avoid using the range pattern /^metrics:/,/^[a-z]+:/ because + # "metrics:" matches both the start and end pattern simultaneously in awk, + # causing the range to open and close on the same line (CURRENT always empty → infinite loop). + # Also, \s is not POSIX awk; use "^ +" instead. + CURRENT=$(awk '/^metrics:/{found=1; next} found && /^[a-z]/{exit} found && /^ +tag:/{gsub(/"/, "", $2); print $2; exit}' values.yaml) echo "current_exporter_version=$CURRENT" >> $GITHUB_OUTPUT echo "Current redis-exporter version: $CURRENT"