Skip to content

Commit d9a102e

Browse files
committed
Add version validation step
Validates version format before attempting downloads to provide clearer error messages. Versions must match the pattern v1.2.3 (with optional suffixes like -rc1). Also adds debug logging when debug mode is enabled, showing the versions that will be downloaded.
1 parent 0fd0e2d commit d9a102e

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

action.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,30 @@ outputs:
8282
runs:
8383
using: 'composite'
8484
steps:
85+
- name: Validate versions
86+
shell: bash
87+
run: |
88+
# Validate cagent version format
89+
if ! [[ "${{ inputs.cagent-version }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then
90+
echo "::error::Invalid cagent version format '${{ inputs.cagent-version }}'. Expected format: v1.2.3"
91+
exit 1
92+
fi
93+
94+
# Validate mcp-gateway version format if it will be installed
95+
if [[ "${{ inputs.mcp-gateway }}" == "true" ]]; then
96+
if ! [[ "${{ inputs.mcp-gateway-version }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then
97+
echo "::error::Invalid mcp-gateway version format '${{ inputs.mcp-gateway-version }}'. Expected format: v1.2.3"
98+
exit 1
99+
fi
100+
fi
101+
102+
if [[ "${{ inputs.debug }}" == "true" ]]; then
103+
echo "::debug::Version validation passed"
104+
echo "::debug::cagent version: ${{ inputs.cagent-version }}"
105+
echo "::debug::mcp-gateway version: ${{ inputs.mcp-gateway-version }}"
106+
echo "::debug::mcp-gateway install: ${{ inputs.mcp-gateway }}"
107+
fi
108+
85109
- name: Download cagent binary
86110
shell: bash
87111
run: |

0 commit comments

Comments
 (0)