File tree Expand file tree Collapse file tree 1 file changed +3
-15
lines changed Expand file tree Collapse file tree 1 file changed +3
-15
lines changed Original file line number Diff line number Diff line change 88 id : dotnet
99 shell : bash
1010 run : |
11- # Try to read versions from .github/workflows/dotnet.json first
1211 if [ -f .github/workflows/dotnet.json ]; then
13- VERSIONS=$(jq -r '.[]' .github/workflows/dotnet.json | tr '\n' ',' | sed 's/,$//' )
12+ VERSIONS=$(jq -r '.[]' .github/workflows/dotnet.json)
1413 else
15- VERSIONS=$(gh api repos/${{ github.repository }}/properties/values | jq -r '.[] | select(.property_name == "DOTNET") | .value')
14+ VERSIONS=$(gh api repos/${{ github.repository }}/properties/values | jq -r '[ .[] | select(.property_name == "DOTNET") | .value] | join(",") | split(",")[] | gsub("^\\s+|\\s+$"; "") ')
1615 fi
17- # Remove extra whitespace from VERSIONS
18- VERSIONS=$(echo "$VERSIONS" | tr -s ' ' | tr -d ' ')
19- # Convert comma-separated to newline-separated
20- NEWLINE_VERSIONS=$(echo "$VERSIONS" | tr ',' '\n')
21- # Validate versions
22- while IFS= read -r version; do
23- if ! [[ $version =~ ^[0-9]+(\.[0-9]+(\.[0-9]+)?)?(\.x)?$ ]]; then
24- echo "Error: Invalid version format: $version"
25- exit 1
26- fi
27- done <<< "$NEWLINE_VERSIONS"
2816 # Write multiline output to $GITHUB_OUTPUT
2917 {
3018 echo 'versions<<EOF'
31- echo "$NEWLINE_VERSIONS "
19+ echo "$VERSIONS "
3220 echo 'EOF'
3321 } >> $GITHUB_OUTPUT
3422
You can’t perform that action at this time.
0 commit comments