Skip to content

Commit 2f0a155

Browse files
committed
Allow specifying required dotnet versions in a file
This is a workaround for PRs from forks without access to GH_TOKEN secret (and therefore no API access to retrieve repo properties)
1 parent 835cefd commit 2f0a155

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

.github/actions/dotnet/action.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ runs:
88
id: dotnet
99
shell: bash
1010
run: |
11-
VERSIONS=$(gh api repos/${{ github.repository }}/properties/values | jq -r '.[] | select(.property_name == "DOTNET") | .value')
11+
# Try to read versions from .github/workflows/dotnet.json first
12+
if [ -f .github/workflows/dotnet.json ]; then
13+
VERSIONS=$(jq -r '.[]' .github/workflows/dotnet.json | tr '\n' ',' | sed 's/,$//')
14+
else
15+
VERSIONS=$(gh api repos/${{ github.repository }}/properties/values | jq -r '.[] | select(.property_name == "DOTNET") | .value')
16+
fi
1217
# Remove extra whitespace from VERSIONS
1318
VERSIONS=$(echo "$VERSIONS" | tr -s ' ' | tr -d ' ')
1419
# Convert comma-separated to newline-separated

.github/workflows/dotnet.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[
2+
"6.x",
3+
"8.x",
4+
"9.x"
5+
]

0 commit comments

Comments
 (0)