Skip to content

Commit 930a9b5

Browse files
authored
Create powershell.yml
Testing PSScriptAnalyzer
1 parent 3c37508 commit 930a9b5

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

.github/workflows/powershell.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
#
6+
# https://github.com/microsoft/action-psscriptanalyzer
7+
# For more information on PSScriptAnalyzer in general, see
8+
# https://github.com/PowerShell/PSScriptAnalyzer
9+
10+
name: PSScriptAnalyzer
11+
12+
on:
13+
push:
14+
branches: [ "main" ]
15+
pull_request:
16+
branches: [ "main" ]
17+
schedule:
18+
- cron: '19 18 * * 3'
19+
20+
permissions:
21+
contents: read
22+
23+
jobs:
24+
build:
25+
permissions:
26+
contents: read # for actions/checkout to fetch code
27+
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
28+
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
29+
name: PSScriptAnalyzer
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v3
33+
34+
- name: Run PSScriptAnalyzer
35+
uses: microsoft/psscriptanalyzer-action@6b2948b1944407914a58661c49941824d149734f
36+
with:
37+
# Check https://github.com/microsoft/action-psscriptanalyzer for more info about the options.
38+
# The below set up runs PSScriptAnalyzer to your entire repository and runs some basic security rules.
39+
path: .\
40+
recurse: true
41+
# Include your own basic security rules. Removing this option will run all the rules
42+
includeRule: '"PSAvoidGlobalAliases", "PSAvoidUsingConvertToSecureStringWithPlainText"'
43+
output: results.sarif
44+
45+
# Upload the SARIF file generated in the previous step
46+
- name: Upload SARIF results file
47+
uses: github/codeql-action/upload-sarif@v2
48+
with:
49+
sarif_file: results.sarif

0 commit comments

Comments
 (0)