diff --git a/.github/workflows/python-linting.yml b/.github/workflows/python-linting.yml index 592d8bd..731cff0 100644 --- a/.github/workflows/python-linting.yml +++ b/.github/workflows/python-linting.yml @@ -18,30 +18,32 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Read Python versions - id: set-matrix - run: | - if [[ "$RUNNER_OS" == "Windows" ]]; then - # Windows: Use PowerShell to read the file - if (-Not (Test-Path ".python-version")) { + - name: Set Python versions matrix + run: | + if [[ "$RUNNER_OS" == "Windows" ]]; then + # Windows: Use PowerShell to read the file + pwsh -Command ' + if (-Not (Test-Path ".python-version")) { Write-Error ".python-version file not found" exit 1 - } - $pythonVersions = Get-Content .python-version -Raw | -split ',' - $matrixOutput = $pythonVersions | ForEach-Object { $_.Trim() } - $jsonOutput = $matrixOutput -join '","' - $jsonOutput = "[\"$jsonOutput\"]" - echo "::set-output name=versions::$jsonOutput" - else - # Linux/macOS: Use Bash to read the file - if [ ! -f .python-version ]; then - echo ".python-version file not found" - exit 1 - fi - PYTHON_VERSIONS=$(cat .python-version | tr ',' '\n' | xargs) - echo "::set-output name=versions::$(echo \"$PYTHON_VERSIONS\" | jq -R 'split(\" \")')" + } + $pythonVersions = Get-Content .python-version -Raw | -split "," + $matrixOutput = $pythonVersions | ForEach-Object { $_.Trim() } + $jsonOutput = $matrixOutput -join "\",\"" + $jsonOutput = "[\"$jsonOutput\"]" + Write-Output "::set-output name=versions::$jsonOutput" + ' + else + # Linux/macOS: Use Bash to read the file + if [ ! -f .python-version ]; then + echo ".python-version file not found" + exit 1 fi - shell: bash + PYTHON_VERSIONS=$(cat .python-version | tr ',' '\n' | xargs) + echo "::set-output name=versions::$(echo \"$PYTHON_VERSIONS\" | jq -R 'split(\" \")')" + fi + shell: bash + linters: needs: setup-matrix