Skip to content

Commit f72dc0e

Browse files
committed
20220521A
1 parent 14b1d2e commit f72dc0e

File tree

2 files changed

+38
-55
lines changed

2 files changed

+38
-55
lines changed

.github/workflows/scan-virus.yml

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,9 @@ on:
1818
required: false
1919
default: "true"
2020
jobs:
21-
parse-inputs:
22-
name: "(Parse Inputs)"
23-
runs-on: "ubuntu-latest"
24-
steps:
25-
- run: |
26-
[string]$GitDeep = '${{github.event.inputs.git_deep}}'
27-
if ($GitDeep.Length -eq 0) {
28-
$GitDeep = 'false'
29-
}
30-
Write-Host -Object "::set-output name=git_deep::$GitDeep"
31-
id: "parser"
32-
shell: "pwsh"
33-
outputs:
34-
git_deep: "${{steps.parser.outputs.git_deep}}"
3521
scan-virus:
3622
name: "Scan Virus"
3723
runs-on: "ubuntu-latest"
38-
needs:
39-
- "parse-inputs"
4024
steps:
4125
- name: "Checkout Repository"
4226
uses: "actions/[email protected]"
@@ -45,5 +29,4 @@ jobs:
4529
- name: "Scan Repository"
4630
uses: "hugoalh/[email protected]"
4731
with:
48-
git_deep: "${{needs.parse-inputs.outputs.git_deep}}"
49-
yara_enable: "true"
32+
git_deep: "${{github.event.inputs.git_deep || 'false'}}"

hugoalh.GitHubActionsToolkit/hugoalh.GitHubActionsToolkit.psm1

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ function Add-GitHubActionsProblemMatcher {
204204
'path' {
205205
$Path | ForEach-Object -Process {
206206
return ([string[]](Resolve-Path -Path $_ -Relative) | Where-Object -FilterScript {
207-
return (($null -ne $_) -and ($_.Length -gt 0))
207+
return ($null -ne $_ -and $_.Length -gt 0)
208208
} | ForEach-Object -Process {
209209
return Write-GitHubActionsCommand -Command 'add-matcher' -Message ($_ -replace '^\.[\\\/]', '' -replace '\\', '/')
210210
})
@@ -250,7 +250,7 @@ function Add-GitHubActionsSecretMask {
250250
}
251251
if ($WithChunks) {
252252
[string[]]($Value -split '[\n\r\s\t]+') | ForEach-Object -Process {
253-
if (($_ -ne $Value) -and ($_.Length -ge 2)) {
253+
if ($_ -ne $Value -and $_.Length -ge 2) {
254254
Write-GitHubActionsCommand -Command 'add-mask' -Message $_
255255
}
256256
}
@@ -359,7 +359,7 @@ function Disable-GitHubActionsProcessingCommands {
359359
[OutputType([string])]
360360
param(
361361
[Parameter(Position = 0)][ValidateScript({
362-
return (($_ -match '^.+$') -and ($_.Length -ge 4) -and ($_ -inotin @(
362+
return ($_ -match '^.+$' -and $_.Length -ge 4 -and $_ -inotin @(
363363
'add-mask',
364364
'add-matcher',
365365
'debug',
@@ -372,7 +372,7 @@ function Disable-GitHubActionsProcessingCommands {
372372
'save-state',
373373
'set-output',
374374
'warning'
375-
)))
375+
))
376376
})][Alias('EndKey', 'EndValue', 'Key', 'Token', 'Value')][string]$EndToken = ((New-Guid).Guid -replace '-', '')
377377
)
378378
Write-GitHubActionsCommand -Command 'stop-commands' -Message $EndToken
@@ -469,7 +469,7 @@ function Enable-GitHubActionsProcessingCommands {
469469
[OutputType([void])]
470470
param(
471471
[Parameter(Mandatory = $true, Position = 0)][ValidateScript({
472-
return (($_ -match '^.+$') -and ($_.Length -ge 4) -and ($_ -inotin @(
472+
return ($_ -match '^.+$' -and $_.Length -ge 4 -and $_ -inotin @(
473473
'add-mask',
474474
'add-matcher',
475475
'debug',
@@ -482,7 +482,7 @@ function Enable-GitHubActionsProcessingCommands {
482482
'save-state',
483483
'set-output',
484484
'warning'
485-
)))
485+
))
486486
})][Alias('EndKey', 'EndValue', 'Key', 'Token', 'Value')][string]$EndToken
487487
)
488488
return Write-GitHubActionsCommand -Command $EndToken
@@ -1011,37 +1011,37 @@ function Test-GitHubActionsEnvironment {
10111011
[Alias('Force', 'Forced', 'Required')][switch]$Require
10121012
)
10131013
if (
1014-
($env:CI -ne 'true') -or
1015-
($null -eq $env:GITHUB_ACTION_REPOSITORY) -or
1016-
($null -eq $env:GITHUB_ACTION) -or
1017-
($null -eq $env:GITHUB_ACTIONS) -or
1018-
($null -eq $env:GITHUB_ACTOR) -or
1019-
($null -eq $env:GITHUB_API_URL) -or
1020-
($null -eq $env:GITHUB_ENV) -or
1021-
($null -eq $env:GITHUB_EVENT_NAME) -or
1022-
($null -eq $env:GITHUB_EVENT_PATH) -or
1023-
($null -eq $env:GITHUB_GRAPHQL_URL) -or
1024-
($null -eq $env:GITHUB_JOB) -or
1025-
($null -eq $env:GITHUB_PATH) -or
1026-
($null -eq $env:GITHUB_REF_NAME) -or
1027-
($null -eq $env:GITHUB_REF_PROTECTED) -or
1028-
($null -eq $env:GITHUB_REF_TYPE) -or
1029-
($null -eq $env:GITHUB_REPOSITORY_OWNER) -or
1030-
($null -eq $env:GITHUB_REPOSITORY) -or
1031-
($null -eq $env:GITHUB_RETENTION_DAYS) -or
1032-
($null -eq $env:GITHUB_RUN_ATTEMPT) -or
1033-
($null -eq $env:GITHUB_RUN_ID) -or
1034-
($null -eq $env:GITHUB_RUN_NUMBER) -or
1035-
($null -eq $env:GITHUB_SERVER_URL) -or
1036-
($null -eq $env:GITHUB_SHA) -or
1037-
($null -eq $env:GITHUB_STEP_SUMMARY) -or
1038-
($null -eq $env:GITHUB_WORKFLOW) -or
1039-
($null -eq $env:GITHUB_WORKSPACE) -or
1040-
($null -eq $env:RUNNER_ARCH) -or
1041-
($null -eq $env:RUNNER_NAME) -or
1042-
($null -eq $env:RUNNER_OS) -or
1043-
($null -eq $env:RUNNER_TEMP) -or
1044-
($null -eq $env:RUNNER_TOOL_CACHE)
1014+
$env:CI -ne 'true' -or
1015+
$null -eq $env:GITHUB_ACTION_REPOSITORY -or
1016+
$null -eq $env:GITHUB_ACTION -or
1017+
$null -eq $env:GITHUB_ACTIONS -or
1018+
$null -eq $env:GITHUB_ACTOR -or
1019+
$null -eq $env:GITHUB_API_URL -or
1020+
$null -eq $env:GITHUB_ENV -or
1021+
$null -eq $env:GITHUB_EVENT_NAME -or
1022+
$null -eq $env:GITHUB_EVENT_PATH -or
1023+
$null -eq $env:GITHUB_GRAPHQL_URL -or
1024+
$null -eq $env:GITHUB_JOB -or
1025+
$null -eq $env:GITHUB_PATH -or
1026+
$null -eq $env:GITHUB_REF_NAME -or
1027+
$null -eq $env:GITHUB_REF_PROTECTED -or
1028+
$null -eq $env:GITHUB_REF_TYPE -or
1029+
$null -eq $env:GITHUB_REPOSITORY_OWNER -or
1030+
$null -eq $env:GITHUB_REPOSITORY -or
1031+
$null -eq $env:GITHUB_RETENTION_DAYS -or
1032+
$null -eq $env:GITHUB_RUN_ATTEMPT -or
1033+
$null -eq $env:GITHUB_RUN_ID -or
1034+
$null -eq $env:GITHUB_RUN_NUMBER -or
1035+
$null -eq $env:GITHUB_SERVER_URL -or
1036+
$null -eq $env:GITHUB_SHA -or
1037+
$null -eq $env:GITHUB_STEP_SUMMARY -or
1038+
$null -eq $env:GITHUB_WORKFLOW -or
1039+
$null -eq $env:GITHUB_WORKSPACE -or
1040+
$null -eq $env:RUNNER_ARCH -or
1041+
$null -eq $env:RUNNER_NAME -or
1042+
$null -eq $env:RUNNER_OS -or
1043+
$null -eq $env:RUNNER_TEMP -or
1044+
$null -eq $env:RUNNER_TOOL_CACHE
10451045
) {
10461046
if ($Require) {
10471047
return Write-GitHubActionsFail -Message 'This process require to execute inside the GitHub Actions environment!'

0 commit comments

Comments
 (0)