You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[GitHub Action](https://github.com/features/actions) to run [PSScriptAnalyzer](https://github.com/PowerShell/PSScriptAnalyzer) static code analysis checks on [Pull Requests](https://help.github.com/articles/about-pull-requests/).
3
+
[GitHub Action](https://github.com/features/actions) to run [PSScriptAnalyzer](https://github.com/PowerShell/PSScriptAnalyzer) static code analysis checks on PowerShell for [Pull Requests](https://help.github.com/articles/about-pull-requests/).
4
4
5
5
## Success Criteria
6
6
7
-
This action will succeed if **zero** PSScriptAnalyzer errors are found.
8
-
If any warnings or informational issues are found, a comment will be posted to the pull request but the action will not return a failure.
7
+
By default, this action will succeed if **zero** PSScriptAnalyzer **errors** and **warnings** are found.
8
+
Failing on errors, warnings, or informational issues can be configured. See [Usage](#Usage) below.
9
+
The sending of comments back to the PR if the action fails can be disabled if desired.
9
10
10
11
## Usage
11
12
12
-
Place the following in your `./github/main.workflow` file to run PSScriptAnalyzer on incoming pull requests.
13
-
This action can be triggered from other GitHub events but analyzer results will only be posted as comments to pull requests.
13
+
### Basic
14
14
15
-
> Make sure `secrets = ["GITHUB_TOKEN"]` is present as it is required to post a comment back to the pull request.
15
+
Basic configuration that will run PSSA and fail on errors or warnings
16
16
17
-
```hcl
18
-
workflow "psscriptanalysis" {
19
-
on = "pull_request"
20
-
resolves = "PSScriptAnalyzer"
21
-
}
17
+
, and send a comment back to the PR with a summary.
18
+
Note, that `repoToken` is required for sending comments back.
Advanced configuration that will run PSSA only in the `MyModule` directory, with customer PSSA settings, and fail on errors, warnings, or informational issues.
38
+
A comment back to the PR with the PSSA summary will also be sent if any issues were detected.
27
39
28
-
secrets = ["GITHUB_TOKEN"]
29
40
30
-
# Optional environment variables to control analysis behavior
errorList='{0}The following PSScriptAnalyzer errors caused the check to fail:{1}'
34
-
warningMsg='{0} There were **[{1}]** warnings and **[{2}]** informational issues found. These did not cause the check to fail but it is recommended that they be fixed.'
0 commit comments