Skip to content

Commit eb23d8c

Browse files
committed
Use new Action syntax
1 parent 010a3b7 commit eb23d8c

File tree

2 files changed

+37
-6
lines changed

2 files changed

+37
-6
lines changed

action.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: PSScriptAnalyzer
2+
author: Brandon Olin
3+
description: GitHub Action to run PSScriptAnalyzer static code analysis checks on Pull Requests
4+
inputs:
5+
rootPath:
6+
description: The root directory to run PSScriptAnalyzer on. By default, this is the root of the repository.
7+
default: .
8+
required: false
9+
settingsPath:
10+
description: The path to a PSScriptAnalyser settings file to control rules to execute.
11+
required: false
12+
default: .
13+
INPUT_SENDCOMMENT:
14+
description: Enable/disable sending comments back to PR when PSScriptAnalyzer finds one or more failure checks.
15+
required: false
16+
default: true
17+
# sendCommentOnWarnings:
18+
# description: Enable/disable sending comments back to PR when PSScriptAnalyzer finds one or more warning checks.
19+
# required: false
20+
# default: true
21+
# sendCommentOnInfos:
22+
# description: Enable/disable sending comments back to PR when PSScriptAnalyzer finds one or more information checks.
23+
# required: false
24+
# default: false
25+
outputs:
26+
runs:
27+
using: docker
28+
image: Dockerfile
29+
branding:
30+
icon: check-square
31+
color: green

entrypoint.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ $analyzeParams = @{
1212
}
1313

1414
# By default, run PSScriptAnalyzer on the whole repository
15-
# but allow overriding this with PSSCRIPTANALYZER_ROOT environment variable
16-
if ($env:PSSCRIPTANALYZER_ROOT) {
17-
$analyzeParams.Path = $env:PSSCRIPTANALYZER_ROOT
15+
# but allow overriding this with INPUT_ROOTPATH environment variable
16+
if ($env:INPUT_ROOTPATH) {
17+
$analyzeParams.Path = $env:INPUT_ROOTPATH
1818
} else {
1919
$analyzeParams.Path = $env:GITHUB_WORKSPACE
2020
}
2121

2222
# Path to custom script analzyer settings
23-
if ($env:PSSCRIPTANALYZER_SETTINGS_PATH) {
24-
$analyzeParams.Settings = $env:PSSCRIPTANALYZER_SETTINGS_PATH
23+
if ($env:INPUT_SETTINGSPATH) {
24+
$analyzeParams.Settings = $env:INPUT_SETTINGSPATH
2525
}
2626

2727
# Run PSScriptAnalyzer
@@ -55,7 +55,7 @@ $ghEvent = Get-Content -Path $env:GITHUB_EVENT_PATH | ConvertFrom-Json
5555
$commentsUrl = $ghEvent.pull_request.comments_url
5656

5757
# Send comment back to PR if any errors were found
58-
if ($env:PSSCRIPTANALYZER_SEND_COMMENT -ne 'false' -and $env:PSSCRIPTANALYZER_SEND_COMMENT -ne 0 -and $commentsUrl) {
58+
if ($env:INPUT_SENDCOMMENT -ne 'false' -and $env:INPUT_SENDCOMMENT -ne 0 -and $commentsUrl) {
5959
if ($errors -gt 0) {
6060
$params = @{
6161
Uri = $commentsUrl

0 commit comments

Comments
 (0)