Skip to content

Commit 86853c4

Browse files
committed
fix: use table output and GITHUB_ENV for registry list validation
Avoids jq dependency and wrapper stdout pollution. Captures table-format output via GITHUB_ENV multiline syntax, then validates header and first data row with regex (same pattern as the version check step). https://claude.ai/code/session_01Y8NseCm28GqE8nQ1Yvg5aa
1 parent e2161d3 commit 86853c4

1 file changed

Lines changed: 23 additions & 11 deletions

File tree

.github/workflows/setup-stackql-test.yml

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,30 @@ jobs:
2929
with:
3030
use_wrapper: ${{matrix.use_wrapper}}
3131

32-
- name: Run Registry List and Validate
32+
- name: Run Registry List
33+
id: run-registry-list
3334
run: |
34-
OUTPUT=$(stackql exec --output json "REGISTRY LIST")
35-
echo "Registry list output:"
36-
echo "$OUTPUT"
35+
echo "registry_list_output<<EOF" >> $GITHUB_ENV
36+
stackql exec "REGISTRY LIST" >> $GITHUB_ENV
37+
echo "EOF" >> $GITHUB_ENV
3738
38-
# When the wrapper is active, @actions/exec also prints the command line before the
39-
# output, and core.debug() appends ::debug:: annotations immediately after the JSON
40-
# (on the same line, since the JSON has no trailing newline). Strip workflow commands
41-
# and then keep only lines that look like JSON (starting with [ or {).
42-
CLEAN_JSON=$(echo "$OUTPUT" | sed 's/::[a-z-]*::.*$//' | grep -E '^\s*[\[{]')
39+
- name: Validate Registry List
40+
run: |
41+
echo "Registry list output:"
42+
echo "${{ env.registry_list_output }}"
43+
44+
# Validate header row: expect | provider | and | version | columns
45+
HEADER_REGEX='\|\s*provider\s*\|\s*version\s*\|'
46+
if ! [[ "${{ env.registry_list_output }}" =~ $HEADER_REGEX ]]; then
47+
echo "Registry list header does not match expected format"
48+
exit 1
49+
fi
50+
51+
# Validate at least one data row: | <name> | v<major>.<minor>.<patch> |
52+
DATA_ROW_REGEX='\|\s*[a-z][a-z0-9_]*\s*\|\s*v[0-9]+\.[0-9]+\.[0-9]+\s*\|'
53+
if ! [[ "${{ env.registry_list_output }}" =~ $DATA_ROW_REGEX ]]; then
54+
echo "Registry list does not contain a valid data row"
55+
exit 1
56+
fi
4357
44-
# Validate JSON structure: array of objects each with provider and version keys
45-
echo "$CLEAN_JSON" | jq -e 'type == "array" and (all(.[]; has("provider") and has("version")))' > /dev/null
4658
echo "Registry list validated successfully."

0 commit comments

Comments
 (0)