Skip to content

Commit 1eef583

Browse files
Update r.yml
1 parent 249fe83 commit 1eef583

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

.github/workflows/r.yml

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
r-version: ['3.6.3', '4.1.1']
2626

2727
steps:
28-
- uses: actions/checkout@v4
28+
- uses: actions/checkout@v5
2929
- name: Set up R ${{ matrix.r-version }}
3030
uses: r-lib/actions/setup-r@f57f1301a053485946083d7a45022b278929a78a
3131
with:
@@ -38,3 +38,37 @@ jobs:
3838
- name: Check
3939
run: rcmdcheck::rcmdcheck(args = "--no-manual", error_on = "error")
4040
shell: Rscript {0}
41+
42+
lint-with-PSScriptAnalyzer:
43+
name: Install and run PSScriptAnalyzer
44+
runs-on: ubuntu-latest
45+
steps:
46+
- uses: actions/checkout@v5
47+
- name: Install PSScriptAnalyzer module
48+
shell: pwsh
49+
run: |
50+
Set-PSRepository PSGallery -InstallationPolicy Trusted
51+
Install-Module PSScriptAnalyzer -ErrorAction Stop
52+
- name: Lint with PSScriptAnalyzer
53+
shell: pwsh
54+
run: |
55+
Invoke-ScriptAnalyzer -Path *.ps1 -Recurse -Outvariable issues
56+
$errors = $issues.Where({$_.Severity -eq 'Error'})
57+
$warnings = $issues.Where({$_.Severity -eq 'Warning'})
58+
if ($errors) {
59+
Write-Error "There were $($errors.Count) errors and $($warnings.Count) warnings total." -ErrorAction Stop
60+
} else {
61+
Write-Output "There were $($errors.Count) errors and $($warnings.Count) warnings total."
62+
}
63+
64+
jobs:
65+
install-dependencies:
66+
name: Install dependencies
67+
runs-on: ubuntu-latest
68+
steps:
69+
- uses: actions/checkout@v5
70+
- name: Install from PSGallery
71+
shell: pwsh
72+
run: |
73+
Set-PSRepository PSGallery -InstallationPolicy Trusted
74+
Install-Module SqlServer, PSScriptAnalyzer

0 commit comments

Comments
 (0)