Bumps the github-actions group with 2 updates in the / directory: [github/gh-aw-actions/setup](https://github.com/github/gh-aw-actions) and [actions/checkout](https://github.com/actions/checkout). Updates `github/gh-aw-actions/setup` from 0.88.8 to 0.90.1 - [Release notes](https://github.com/github/gh-aw-actions/releases) - [Changelog](https://github.com/github/gh-aw-actions/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/gh-aw-actions/compare/5e508589e03a7757a7e05b26e834292f5445bfb6...7c1d4b7ab319216ef4a931cc3dcb0d7245144ff1) Updates `actions/checkout` from 3.7.0 to 7.0.1 - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3.7.0...3d3c42e5aac5ba805825da76410c181273ba90b1) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: 7.0.1 dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: github/gh-aw-actions/setup dependency-version: 0.89.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions ... Signed-off-by: dependabot[bot] <support@github.com>
48 lines
1.4 KiB
YAML
48 lines
1.4 KiB
YAML
name: PSScriptAnalyzer
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
paths:
|
|
- "**/*.ps1"
|
|
- "**/*.psm1"
|
|
- "**/*.psd1"
|
|
push:
|
|
paths:
|
|
- "**/*.ps1"
|
|
- "**/*.psm1"
|
|
- "**/*.psd1"
|
|
|
|
permissions:
|
|
contents: read # Needed to check out the code
|
|
pull-requests: read # Needed to read pull request details
|
|
|
|
jobs:
|
|
analyze:
|
|
runs-on: windows-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
- name: Install PSScriptAnalyzer
|
|
run: |
|
|
Install-Module -Name PSScriptAnalyzer -Force -SkipPublisherCheck -Scope CurrentUser
|
|
- name: Run PSScriptAnalyzer
|
|
run: |
|
|
# Run PSScriptAnalyzer on all PowerShell scripts
|
|
$results = @(Get-ChildItem -Recurse -Filter *.ps1 | Invoke-ScriptAnalyzer)
|
|
$results += @(Get-ChildItem -Recurse -Filter *.psm1 | Invoke-ScriptAnalyzer)
|
|
if ($results) {
|
|
Write-Output $results | Format-List -GroupBy ScriptName
|
|
}
|
|
|
|
# If errors are found, exit with a non-zero exit code to fail the job
|
|
if ($results.where({$_.Severity -eq 'Error'})) {
|
|
Write-Host "Found script issues (errors)."
|
|
exit 1 # Exit with a non-zero status to fail the job
|
|
} else {
|
|
Write-Host "No blocking detections."
|
|
}
|