Skip to content

Commit

Permalink
20211223B
Browse files Browse the repository at this point in the history
  • Loading branch information
hugoalh committed Dec 23, 2021
1 parent 0c5a2ac commit 9e2aa88
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,12 @@ Require Software:
**\[Optional\]** `<string = "none">` Integrate with service.

- **`"none"`:** No integration.
- **`"git"`:** Git integration.
- **`"npm:<Package>"`:** NPM integration with package name `<Package>`.
- **`"git"`:** Git integration with previously checkouted repository via `actions/checkout`.
- **`"npm:<Package>"`:** NPM integration with package `<Package>`.
> **⚠ Important:**
>
> - This only support packages which inside the official registry.
> - This require a clean workspace.

#### `list_elements`

Expand Down
9 changes: 5 additions & 4 deletions main.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 '\/', '-'
Expand Down

0 comments on commit 9e2aa88

Please sign in to comment.