Skip to content

Analyze Code

Analyze Code #3

Workflow file for this run

name: Analyze Code
on:
workflow_dispatch:
jobs:
Analyze-Code:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Analyze Code with PSScriptAnalyzer
shell: pwsh
run : |
$ExcludedRules = @('PSAvoidUsingWriteHost')
$Findings = Get-ChildItem -Path Modules/ibPS/Functions/*.ps1 -Recurse -File | %{ Invoke-ScriptAnalyzer $_ -ExcludeRule $ExcludedRules}
$Findings | Select-Object ScriptName,Severity,Line,Column,RuleName,Message | ConvertTo-Csv | Set-Content ./docs/analysis.csv -Force
- name: Update Repository
run: |
git config --global user.name ${{ github.actor }}
git config --global user.password ${{ secrets.GIT_ACTIONS }}
git config --global user.email 'mat.cox@tmmn.uk'
git add .
git status
if ! git diff-index --quiet HEAD; then
git commit -m "Updated Code Analysis"
git push
else
echo "Code Analysis not changed."
fi