File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change 99 shell : bash
1010 run : |
1111 VERSIONS=$(gh api /repos/${{ github.repository }}/properties/values | jq -r '.[] | select(.property_name == "DOTNET") | .value')
12- echo "versions=$VERSIONS" >> $GITHUB_OUTPUT
12+ # Remove extra whitespace from VERSIONS
13+ VERSIONS=$(echo "$VERSIONS" | tr -s ' ' | tr -d ' ')
14+ # Convert comma-separated to newline-separated
15+ NEWLINE_VERSIONS=$(echo "$VERSIONS" | tr ',' '\n')
16+ # Validate versions
17+ while IFS= read -r version; do
18+ if ! [[ $version =~ ^[0-9]+(\.[0-9]+(\.[0-9]+)?)?(\.x)?$ ]]; then
19+ echo "Error: Invalid version format: $version"
20+ exit 1
21+ fi
22+ done <<< "$NEWLINE_VERSIONS"
23+ # Write multiline output to $GITHUB_OUTPUT
24+ {
25+ echo 'versions<<EOF'
26+ echo "$NEWLINE_VERSIONS"
27+ echo 'EOF'
28+ } >> $GITHUB_OUTPUT
1329
1430 - name : ⚙ dotnet
1531 if : steps.dotnet.outputs.versions != ''
1632 uses : actions/setup-dotnet@v4
1733 with :
18- dotnet-version : ${{ steps.dotnet.outputs.versions }}
34+ dotnet-version : |
35+ ${{ steps.dotnet.outputs.versions }}
You can’t perform that action at this time.
0 commit comments