From 2254cf000251f7f2bfe58d493cf1e3cac87681f7 Mon Sep 17 00:00:00 2001 From: FantasqueX Date: Thu, 1 Feb 2024 17:55:57 +0800 Subject: [PATCH] Add PSScriptAnalyzer action (#59) Also fix some style problem found by PSScriptAnalyzer. Pull request: https://github.com/lefou/millw/pull/59 --- .github/workflows/ci.yml | 15 +++++++++++++-- millw.ps1 | 7 +++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3c3d437..4084005 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,7 @@ name: CI on: [push, pull_request] jobs: - check: + shell: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 @@ -12,4 +12,15 @@ jobs: run: sudo apt-get install -y make shellcheck - name: Check - run: make clean check \ No newline at end of file + run: make clean check + + PowerShell: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Run PSScriptAnalyzer + uses: microsoft/psscriptanalyzer-action@v1.1 + with: + path: .\millw.ps1 + enableExit: true diff --git a/millw.ps1 b/millw.ps1 index 747df3f..34e9270 100644 --- a/millw.ps1 +++ b/millw.ps1 @@ -1,5 +1,5 @@ # This is a wrapper script, that automatically download mill from GitHub release pages -# You can give the required mill version with -MillVersion parameter +# You can give the required mill version with --mill-version parameter # If no version is given, it falls back to the value of DEFAULT_MILL_VERSION # # Project page: https://github.com/lefou/millw @@ -69,10 +69,9 @@ if ($null -eq $MILL_VERSION) { if ($null -eq $MILL_VERSION) { Write-Output 'Retrieving latest mill version ...' - + # https://github.com/PowerShell/PowerShell/issues/20964 - $targetUrl = - try { + $targetUrl = try { Invoke-WebRequest -Uri "$MILL_REPO_URL/releases/latest" -MaximumRedirection 0 } catch {