Skip to content

Commit

Permalink
Not interested in figuring out codeql's action right now
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanbergstrom committed Jan 29, 2024
1 parent 5df307b commit 0d1bd01
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 43 deletions.
86 changes: 43 additions & 43 deletions .github/workflows/lint-powershell.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
name: PSScriptAnalyzer

defaults:
run:
shell: pwsh

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: '22 1 * * 3'

permissions:
contents: read

jobs:
build:
permissions:
contents: read
security-events: write
name: PSScriptAnalyzer
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Install AnyPackage
run: Install-Module AnyPackage -Force -AllowClobber

- name: Install ConvertToSARIF
run: Install-Module ConvertToSARIF -Force

- name: Run PSScriptAnalyzer
run: |
Import-Module AnyPackage, ConvertToSARIF
Invoke-ScriptAnalyzer -Path . -Recurse | ConvertTo-SARIF -FilePath results.sarif
- name: Upload SARIF results file
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: results.sarif
# name: PSScriptAnalyzer

# defaults:
# run:
# shell: pwsh

# on:
# push:
# branches: [ "main" ]
# pull_request:
# branches: [ "main" ]
# schedule:
# - cron: '22 1 * * 3'

# permissions:
# contents: read

# jobs:
# build:
# permissions:
# contents: read
# security-events: write
# name: PSScriptAnalyzer
# runs-on: ubuntu-latest
# steps:
# - name: Checkout Repository
# uses: actions/checkout@v3

# - name: Install AnyPackage
# run: Install-Module AnyPackage -Force -AllowClobber

# - name: Install ConvertToSARIF
# run: Install-Module ConvertToSARIF -Force

# - name: Run PSScriptAnalyzer
# run: |
# Import-Module AnyPackage, ConvertToSARIF
# Invoke-ScriptAnalyzer -Path . -Recurse | ConvertTo-SARIF -FilePath results.sarif

# - name: Upload SARIF results file
# uses: github/codeql-action/upload-sarif@v2
# with:
# sarif_file: results.sarif
9 changes: 9 additions & 0 deletions tests/AnyPackage.Homebrew.Static.Tests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Get-ChildItem .\ -Recurse -File | ForEach-Object {
Describe "file $($_) should not produce any PSScriptAnalyzer warnings" {
Invoke-ScriptAnalyzer -Path $_.FullName | ForEach-Object {
It "should not fail rule $($_.RuleName) on line $($_.Line) with message ""$($_.Message)""" {
$false | Should -Be $true
}
}
}
}

0 comments on commit 0d1bd01

Please sign in to comment.