fix(vscode): resolve 14 dependency security vulnerabilities (8 high, 4 medium, 2 low) #41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| pull_request: | |
| branches: [main] | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: {} | |
| env: | |
| DOTNET_VERSION: '8.0.x' | |
| NODE_VERSION: '20.x' | |
| jobs: | |
| changes: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| outputs: | |
| psdocs: ${{ steps.filter.outputs.psdocs }} | |
| psdocs-azure: ${{ steps.filter.outputs.psdocs-azure }} | |
| vscode: ${{ steps.filter.outputs.vscode }} | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Detect changed paths | |
| id: filter | |
| run: | | |
| if [ "${{ github.event_name }}" = "push" ]; then | |
| BASE_SHA="${{ github.event.before }}" | |
| else | |
| BASE_SHA="${{ github.event.pull_request.base.sha }}" | |
| fi | |
| CHANGED=$(git diff --name-only "$BASE_SHA" "${{ github.sha }}" 2>/dev/null || echo "") | |
| echo "psdocs=$(echo "$CHANGED" | grep -qE '^(packages/psdocs/|build/|scripts/|build\.ps1)' && echo true || echo false)" >> $GITHUB_OUTPUT | |
| echo "psdocs-azure=$(echo "$CHANGED" | grep -qE '^(packages/psdocs-azure/|packages/psdocs/|build/|scripts/|build\.ps1)' && echo true || echo false)" >> $GITHUB_OUTPUT | |
| echo "vscode=$(echo "$CHANGED" | grep -qE '^(packages/vscode-extension/|\.github/workflows/vscode-ci\.yml)' && echo true || echo false)" >> $GITHUB_OUTPUT | |
| build-psdocs: | |
| needs: changes | |
| if: needs.changes.outputs.psdocs == 'true' || github.event_name == 'push' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1 | |
| with: | |
| dotnet-version: | | |
| 7.0.x | |
| ${{ env.DOTNET_VERSION }} | |
| - name: Setup PowerShell | |
| shell: pwsh | |
| run: | | |
| Set-PSRepository -Name PSGallery -InstallationPolicy Trusted | |
| Install-Module -Name InvokeBuild -MinimumVersion 5.4.0 -Scope CurrentUser -Force | |
| if (Test-Path packages/psdocs/pipeline.build.ps1) { | |
| Set-Location packages/psdocs | |
| Invoke-Build Build -File ./pipeline.build.ps1 | |
| } else { | |
| Write-Host "PSDocs package not yet added - skipping build" | |
| } | |
| - name: Test PSDocs | |
| shell: pwsh | |
| run: | | |
| if (Test-Path packages/psdocs/pipeline.build.ps1) { | |
| Set-Location packages/psdocs | |
| Invoke-Build Test -File ./pipeline.build.ps1 | |
| } | |
| - name: Upload PSDocs Module | |
| if: success() && hashFiles('packages/psdocs/out/modules/PSDocs/**') != '' | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: psdocs-module | |
| path: packages/psdocs/out/modules/PSDocs/ | |
| build-psdocs-azure: | |
| needs: [changes, build-psdocs] | |
| if: | | |
| always() && | |
| (needs.changes.outputs.psdocs-azure == 'true' || github.event_name == 'push') && | |
| (needs.build-psdocs.result == 'success' || needs.build-psdocs.result == 'skipped') | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Install dependencies | |
| shell: pwsh | |
| timeout-minutes: 3 | |
| run: ./scripts/pipeline-deps.ps1 | |
| - name: Download PSDocs Module | |
| uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1 | |
| with: | |
| name: psdocs-module | |
| path: packages/psdocs/out/modules/PSDocs/ | |
| continue-on-error: true | |
| - name: Install PSDocs from Gallery (fallback) | |
| shell: pwsh | |
| run: | | |
| if (-not (Test-Path packages/psdocs/out/modules/PSDocs)) { | |
| Install-Module -Name PSDocs -Scope CurrentUser -Force | |
| } | |
| - name: Build PSDocs.Azure | |
| shell: pwsh | |
| working-directory: packages/psdocs-azure | |
| run: | | |
| Invoke-Build Build -File ./pipeline.build.ps1 -Configuration Release -AssertStyle GitHubActions | |
| - name: Upload PSDocs.Azure Module | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: psdocs-azure-module | |
| path: packages/psdocs-azure/out/modules/PSDocs.Azure/ | |
| - name: Upload PSRule Results | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| if: always() | |
| with: | |
| name: Module.PSRule.TestResults | |
| path: packages/psdocs-azure/reports/ps-rule*.xml | |
| retention-days: 3 | |
| if-no-files-found: ignore | |
| test: | |
| name: Test (${{ matrix.rid }}-${{ matrix.shell }}) | |
| needs: build-psdocs-azure | |
| if: needs.build-psdocs-azure.result == 'success' | |
| runs-on: ${{ matrix.os }} | |
| permissions: | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: ['ubuntu-latest'] | |
| rid: ['linux-x64'] | |
| shell: ['pwsh'] | |
| include: | |
| - os: windows-latest | |
| rid: win-x64 | |
| shell: pwsh | |
| - os: windows-latest | |
| rid: win-x64 | |
| shell: powershell | |
| - os: ubuntu-latest | |
| rid: linux-x64 | |
| shell: pwsh | |
| - os: ubuntu-latest | |
| rid: linux-musl-x64 | |
| shell: pwsh | |
| - os: macos-latest | |
| rid: osx-x64 | |
| shell: pwsh | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - if: ${{ matrix.shell == 'pwsh' }} | |
| name: Install dependencies (PowerShell) | |
| shell: pwsh | |
| timeout-minutes: 3 | |
| run: ./scripts/pipeline-deps.ps1 | |
| - if: ${{ matrix.shell == 'powershell' }} | |
| name: Install dependencies (Windows PowerShell) | |
| shell: powershell | |
| timeout-minutes: 3 | |
| run: ./scripts/pipeline-deps.ps1 | |
| - name: Download module | |
| uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1 | |
| with: | |
| name: psdocs-azure-module | |
| path: packages/psdocs-azure/out/modules/PSDocs.Azure | |
| - if: ${{ matrix.shell == 'pwsh' }} | |
| name: Test module (PowerShell) | |
| shell: pwsh | |
| timeout-minutes: 15 | |
| working-directory: packages/psdocs-azure | |
| run: Invoke-Build TestModule -File ./pipeline.build.ps1 -Configuration Release -AssertStyle GitHubActions | |
| - if: ${{ matrix.shell == 'powershell' }} | |
| name: Test module (Windows PowerShell) | |
| shell: powershell | |
| timeout-minutes: 30 | |
| working-directory: packages/psdocs-azure | |
| run: Invoke-Build TestModule -File ./pipeline.build.ps1 -Configuration Release -AssertStyle GitHubActions | |
| build-vscode: | |
| needs: changes | |
| if: needs.changes.outputs.vscode == 'true' || github.event_name == 'push' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Check for VS Code extension | |
| id: check | |
| run: | | |
| if [ -f "packages/vscode-extension/package.json" ]; then | |
| echo "exists=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "exists=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Install dependencies | |
| if: steps.check.outputs.exists == 'true' | |
| working-directory: packages/vscode-extension | |
| run: npm ci | |
| - name: Lint | |
| if: steps.check.outputs.exists == 'true' | |
| working-directory: packages/vscode-extension | |
| run: npm run lint | |
| - name: Build | |
| if: steps.check.outputs.exists == 'true' | |
| working-directory: packages/vscode-extension | |
| run: npm run compile | |
| - name: Package VSIX | |
| if: steps.check.outputs.exists == 'true' | |
| working-directory: packages/vscode-extension | |
| run: npx @vscode/vsce package --out psdocs-vscode.vsix | |
| - name: Upload VSIX | |
| if: steps.check.outputs.exists == 'true' | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: vscode-vsix | |
| path: packages/vscode-extension/psdocs-vscode.vsix |