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 8
8
id : dotnet
9
9
shell : bash
10
10
run : |
11
- # Try to read versions from .github/workflows/dotnet.json first
12
11
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)
14
13
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+$"; "") ')
16
15
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"
28
16
# Write multiline output to $GITHUB_OUTPUT
29
17
{
30
18
echo 'versions<<EOF'
31
- echo "$NEWLINE_VERSIONS "
19
+ echo "$VERSIONS "
32
20
echo 'EOF'
33
21
} >> $GITHUB_OUTPUT
34
22
You can’t perform that action at this time.
0 commit comments