Skip to content

Commit 55be20e

Browse files
committed
Update action.yml
1 parent 4287d60 commit 55be20e

1 file changed

Lines changed: 23 additions & 3 deletions

File tree

.github/actions/dotnet/action.yml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,32 @@ runs:
99
shell: bash
1010
run: |
1111
VERSIONS=$(gh api /repos/${{ github.repository }}/properties/values | jq -r '.[] | select(.property_name == "DOTNET") | .value')
12-
VERSIONS=$(echo "$VERSIONS" | tr ',' '\n')
13-
echo "versions=$VERSIONS" >> $GITHUB_OUTPUT
12+
# Convert comma-separated to newline-separated
13+
NEWLINE_VERSIONS=$(echo "$VERSIONS" | tr ',' '\n')
14+
# Validate versions
15+
while IFS= read -r version; do
16+
if ! [[ $version =~ ^[0-9]+(\.[0-9]+(\.[0-9]+)?)?(\.x)?$ ]]; then
17+
echo "Error: Invalid version format: $version"
18+
exit 1
19+
fi
20+
done <<< "$NEWLINE_VERSIONS"
21+
# Write multiline output to $GITHUB_OUTPUT
22+
{
23+
echo 'versions<<EOF'
24+
echo "$NEWLINE_VERSIONS"
25+
echo 'EOF'
26+
} >> $GITHUB_OUTPUT
27+
28+
- name: ⚙ versions
29+
if: steps.dotnet.outputs.versions != ''
30+
shell: bash
31+
run: |
32+
echo "Versions:"
33+
echo "${{ steps.dotnet.outputs.versions }}"
1434
1535
- name: ⚙ dotnet
1636
if: steps.dotnet.outputs.versions != ''
1737
uses: actions/setup-dotnet@v4
1838
with:
1939
dotnet-version: |
20-
${{ join(split(steps.dotnet.outputs.versions, ','), '\n') }}
40+
${{ steps.dotnet.outputs.versions }}

0 commit comments

Comments
 (0)