From fb851b3d6f0ddc5768d103066164d85ad526e39a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Hjelm=C3=A5s?= Date: Sun, 22 Feb 2026 14:25:24 +0100 Subject: [PATCH] Refactor GitHub Actions workflow for PowerShell script validation and update TODO comment in myvms.ps1 --- .github/workflows/validate.yml | 30 +++++++++--------------------- scripts/myvms.ps1 | 2 +- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 6c59b7e..c442479 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -1,30 +1,18 @@ -# .github/workflows/validate.yml -name: Validate PowerShell Scripts +name: PSScriptAnalyzer on: push: - paths: - - "scripts/**/*.ps1" - - ".github/workflows/validate.yml" pull_request: - paths: - - "scripts/**/*.ps1" - - ".github/workflows/validate.yml" jobs: - validate: - runs-on: ubuntu-latest + analyze: + runs-on: ubuntu-latest # required host runner + container: + image: gossin/secsrv-cicd:2112 # your full environment is here + steps: - - name: Checkout + - name: Checkout repo # needed so the container sees your scripts uses: actions/checkout@v4 - - name: Install PSScriptAnalyzer - shell: pwsh - run: | - Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted - Install-Module PSScriptAnalyzer -Scope CurrentUser -Force -SkipPublisherCheck - - - name: Run ScriptAnalyzer - shell: pwsh - run: | - Invoke-ScriptAnalyzer -EnableExit scripts/*.ps1 + - name: Run ScriptAnalyzer on all PowerShell files + run: pwsh -Command "Invoke-ScriptAnalyzer -Path . -Recurse -EnableExit" diff --git a/scripts/myvms.ps1 b/scripts/myvms.ps1 index 51b6d9b..1133295 100644 --- a/scripts/myvms.ps1 +++ b/scripts/myvms.ps1 @@ -1,7 +1,7 @@ param($logintype = $(throw "Parameter logintype is required")) # Usage: myvms.ps1 [mgr|cl1|dc1|srv1|mgra|cl1a|dc1a|srv1a] -# TODO: fix til full script syntaks ala oblig 1 +# TODO: fix til full script syntaks som oblig 1 # floating ip's and the Admin-user-password for each host (retrieve from SkyHiGh): $mgr_ip =''