From 9e2aa88d1c56bbeda7815b35b8bf049f685f05af Mon Sep 17 00:00:00 2001 From: hugoalh <32359235+hugoalh@users.noreply.github.com> Date: Thu, 23 Dec 2021 17:37:30 +0800 Subject: [PATCH] 20211223B --- README.md | 8 ++++++-- main.ps1 | 9 +++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index cb7dda02..5da3446d 100644 --- a/README.md +++ b/README.md @@ -57,8 +57,12 @@ Require Software: **\[Optional\]** `` Integrate with service. - **`"none"`:** No integration. -- **`"git"`:** Git integration. -- **`"npm:"`:** NPM integration with package name ``. +- **`"git"`:** Git integration with previously checkouted repository via `actions/checkout`. +- **`"npm:"`:** NPM integration with package ``. + > **⚠ Important:** + > + > - This only support packages which inside the official registry. + > - This require a clean workspace. #### `list_elements` diff --git a/main.ps1 b/main.ps1 index b32a2d78..a9b95798 100644 --- a/main.ps1 +++ b/main.ps1 @@ -124,10 +124,11 @@ function Invoke-ScanVirus { } if ($Integrate -match '^npm:') { Write-Host -Object 'Import NPM information.' - $Elements = Get-ChildItem -Force -Name -Path $env:GITHUB_WORKSPACE -Recurse - if ($Elements.Count -gt 0) { - Write-GHActionsWarning -Message 'NPM integration require a clean workspace! To not show this message again, please do not use `actions/checkout` in the previous steps.' - $Elements | Remove-Item -Force + $UselessElements = Get-ChildItem -Force -Name -Path $env:GITHUB_WORKSPACE -Recurse + if ($UselessElements.Count -gt 0) { + Write-GHActionsWarning -Message 'NPM integration require a clean workspace!' + Write-Host -Object 'Clean workspace.' + $UselessElements | Remove-Item -Force } $NPMPackageName = $Integrate -replace '^npm:', '' $NPMPackageNameEncode = $NPMPackageName -replace '^@', '' -replace '\/', '-'