Skip to content

Commit 4717770

Browse files
authored
Add support for Windows agents (#1)
1 parent a1766ab commit 4717770

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ inputs:
1717
1818
## Usage
1919
20+
### Linux
21+
2022
```yaml
2123
name: SAST
2224
on:
@@ -47,3 +49,38 @@ jobs:
4749
api_url: ${{ vars.COVERITY_ON_POLARIS_API_URL }}
4850
access_token: ${{ secrets.COVERITY_ON_POLARIS_ACCESS_TOKEN }}
4951
```
52+
53+
### Windows
54+
55+
```yaml
56+
name: SAST
57+
on:
58+
workflow_dispatch:
59+
workflow_call:
60+
schedule:
61+
- cron: "0 12 * * *" # Runs at 12:00 everyday
62+
63+
env:
64+
DOTNET_NOLOGO: 1
65+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
66+
67+
jobs:
68+
analyze:
69+
name: Capture and send
70+
runs-on: windows-latest
71+
steps:
72+
- name: Checkout repo
73+
uses: actions/checkout@v3
74+
75+
- name: Setup MSBuild.exe
76+
uses: microsoft/[email protected]
77+
78+
- name: Install dependencies
79+
run: dotnet restore
80+
81+
- name: Static application security testing
82+
uses: visma-prodsec/coverity-on-polaris-workflow@v1
83+
with:
84+
api_url: ${{ vars.COVERITY_ON_POLARIS_API_URL }}
85+
access_token: ${{ secrets.COVERITY_ON_POLARIS_ACCESS_TOKEN }}
86+
```

action.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,27 @@ runs:
3333
echo Removing Polaris CLI
3434
rm -rf /tmp/polari_cli
3535
36+
- if: runner.os == 'Windows'
37+
shell: pwsh
38+
env:
39+
DOTNET_NOLOGO: 1
40+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
41+
POLARIS_ACCESS_TOKEN: ${{ inputs.access_token }}
42+
run: |
43+
Write-Host "Downloading Polaris CLI"
44+
$polarisCliZipPath = Join-Path $env:TEMP "polaris_cli-win64.zip"
45+
Invoke-WebRequest -Uri "${{ inputs.api_url }}/api/tools/v2/downloads/polaris_cli-win64.zip" -OutFile $polarisCliZipPath
46+
47+
Write-Host "Unzipping Polaris CLI"
48+
$polarisCliUnzipPath = Join-Path $env:TEMP "polaris_cli"
49+
Expand-Archive -Path $polarisCliZipPath -DestinationPath $polarisCliUnzipPath
50+
51+
Write-Host "Running Polaris Analysis"
52+
& (Get-ChildItem -Path $polarisCliUnzipPath -Recurse -Filter polaris.exe | Select-Object -First 1).FullName analyze --upload-local-config
53+
54+
Write-Host "Removing Polaris CLI"
55+
Remove-Item -Recurse -Force $polarisCliUnzipPath
56+
3657
branding:
3758
icon: 'shield'
3859
color: 'purple'

0 commit comments

Comments
 (0)