Skip to content

Commit 36255a4

Browse files
committed
20221016C
1 parent 15af6b7 commit 36255a4

File tree

4 files changed

+38
-41
lines changed

4 files changed

+38
-41
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ Import-Module -Name 'hugoalh.GitHubActionsToolkit' -Prefix 'GitHubActions' -Scop
6161
- `Add-GitHubActionsStepSummaryLink`
6262
- `Add-GitHubActionsStepSummarySubscriptText`
6363
- `Add-GitHubActionsStepSummarySuperscriptText`
64+
- `Clear-GitHubActionsFileCommand`
6465
- `Disable-GitHubActionsEchoingCommands`
6566
- `Disable-GitHubActionsProcessingCommands`
6667
- `Enable-GitHubActionsEchoingCommands`
@@ -81,7 +82,6 @@ Import-Module -Name 'hugoalh.GitHubActionsToolkit' -Prefix 'GitHubActions' -Scop
8182
- `Invoke-GitHubActionsToolCacheToolDownloader` 🔘
8283
- `Register-GitHubActionsToolCacheDirectory` 🔘
8384
- `Register-GitHubActionsToolCacheFile` 🔘
84-
- `Remove-GitHubActionsFileCommand`
8585
- `Remove-GitHubActionsProblemMatcher`
8686
- `Remove-GitHubActionsStepSummary`
8787
- `Restore-GitHubActionsCache` 🔘

hugoalh.GitHubActionsToolkit/hugoalh.GitHubActionsToolkit.psd1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
'Add-StepSummaryLink',
7171
'Add-StepSummarySubscriptText',
7272
'Add-StepSummarySuperscriptText',
73+
'Clear-FileCommand',
7374
'Disable-EchoingCommands',
7475
'Disable-ProcessingCommands',
7576
'Enable-EchoingCommands',
@@ -90,7 +91,6 @@
9091
'Invoke-ToolCacheToolDownloader',
9192
'Register-ToolCacheDirectory',
9293
'Register-ToolCacheFile',
93-
'Remove-FileCommand',
9494
'Remove-ProblemMatcher',
9595
'Remove-StepSummary',
9696
'Restore-Cache',
@@ -243,7 +243,7 @@
243243
ReleaseNotes = '(Please visit https://github.com/hugoalh-studio/ghactions-toolkit-powershell/releases.)'
244244

245245
# Prerelease string of this module
246-
Prerelease = 'beta3'
246+
Prerelease = 'beta4'
247247

248248
# Flag to indicate whether the module requires explicit user acceptance for install/update/save
249249
RequireLicenseAcceptance = $False

hugoalh.GitHubActionsToolkit/module/command-base.psm1

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,38 @@ Import-Module -Name (
1515
}
1616
<#
1717
.SYNOPSIS
18+
GitHub Actions - Clear File Command
19+
.DESCRIPTION
20+
Clear the file commands.
21+
.PARAMETER Type
22+
Types of the file commands.
23+
.OUTPUTS
24+
[Void]
25+
#>
26+
Function Clear-FileCommand {
27+
[CmdletBinding(HelpUri = 'https://github.com/hugoalh-studio/ghactions-toolkit-powershell/wiki/api_function_clear-githubactionsfilecommand#Clear-GitHubActionsFileCommand')]
28+
[OutputType([Void])]
29+
Param (
30+
[Parameter(Mandatory = $True, Position = 0)][Alias('Types')][GitHubActionsFileCommandTypes]$Type
31+
)
32+
If (($Type -band [GitHubActionsFileCommandTypes]::EnvironmentVariable) -ieq [GitHubActionsFileCommandTypes]::EnvironmentVariable) {
33+
Remove-Item -LiteralPath $Env:GITHUB_ENV -Confirm:$False -ErrorAction 'Continue'
34+
}
35+
If (($Type -band [GitHubActionsFileCommandTypes]::Output) -ieq [GitHubActionsFileCommandTypes]::Output) {
36+
Remove-Item -LiteralPath $Env:GITHUB_OUTPUT -Confirm:$False -ErrorAction 'Continue'
37+
}
38+
If (($Type -band [GitHubActionsFileCommandTypes]::Path) -ieq [GitHubActionsFileCommandTypes]::Path) {
39+
Remove-Item -LiteralPath $Env:GITHUB_PATH -Confirm:$False -ErrorAction 'Continue'
40+
}
41+
If (($Type -band [GitHubActionsFileCommandTypes]::State) -ieq [GitHubActionsFileCommandTypes]::State) {
42+
Remove-Item -LiteralPath $Env:GITHUB_STATE -Confirm:$False -ErrorAction 'Continue'
43+
}
44+
If (($Type -band [GitHubActionsFileCommandTypes]::StepSummary) -ieq [GitHubActionsFileCommandTypes]::StepSummary) {
45+
Remove-Item -LiteralPath $Env:GITHUB_STEP_SUMMARY -Confirm:$False -ErrorAction 'Continue'
46+
}
47+
}
48+
<#
49+
.SYNOPSIS
1850
GitHub Actions (Private) - Format Command Parameter Value
1951
.DESCRIPTION
2052
Format the command parameter value characters that can cause issues.
@@ -60,38 +92,6 @@ Set-Alias -Name 'Format-CommandContent' -Value 'Format-CommandValue' -Option 'Re
6092
Set-Alias -Name 'Format-CommandMessage' -Value 'Format-CommandValue' -Option 'ReadOnly' -Scope 'Local'
6193
<#
6294
.SYNOPSIS
63-
GitHub Actions - Remove File Command
64-
.DESCRIPTION
65-
Remove the file commands.
66-
.PARAMETER Type
67-
Types of the file commands.
68-
.OUTPUTS
69-
[Void]
70-
#>
71-
Function Remove-FileCommand {
72-
[CmdletBinding(HelpUri = 'https://github.com/hugoalh-studio/ghactions-toolkit-powershell/wiki/api_function_remove-githubactionsfilecommand#Remove-GitHubActionsFileCommand')]
73-
[OutputType([Void])]
74-
Param (
75-
[Parameter(Mandatory = $True, Position = 0)][Alias('Types')][GitHubActionsFileCommandTypes]$Type
76-
)
77-
If (($Type -band [GitHubActionsFileCommandTypes]::EnvironmentVariable) -ieq [GitHubActionsFileCommandTypes]::EnvironmentVariable) {
78-
Remove-Item -LiteralPath $Env:GITHUB_ENV -Confirm:$False -ErrorAction 'Continue'
79-
}
80-
If (($Type -band [GitHubActionsFileCommandTypes]::Output) -ieq [GitHubActionsFileCommandTypes]::Output) {
81-
Remove-Item -LiteralPath $Env:GITHUB_OUTPUT -Confirm:$False -ErrorAction 'Continue'
82-
}
83-
If (($Type -band [GitHubActionsFileCommandTypes]::Path) -ieq [GitHubActionsFileCommandTypes]::Path) {
84-
Remove-Item -LiteralPath $Env:GITHUB_PATH -Confirm:$False -ErrorAction 'Continue'
85-
}
86-
If (($Type -band [GitHubActionsFileCommandTypes]::State) -ieq [GitHubActionsFileCommandTypes]::State) {
87-
Remove-Item -LiteralPath $Env:GITHUB_STATE -Confirm:$False -ErrorAction 'Continue'
88-
}
89-
If (($Type -band [GitHubActionsFileCommandTypes]::StepSummary) -ieq [GitHubActionsFileCommandTypes]::StepSummary) {
90-
Remove-Item -LiteralPath $Env:GITHUB_STEP_SUMMARY -Confirm:$False -ErrorAction 'Continue'
91-
}
92-
}
93-
<#
94-
.SYNOPSIS
9595
GitHub Actions - Write Command
9696
.DESCRIPTION
9797
Write command to communicate with the runner machine.
@@ -163,7 +163,7 @@ Function Write-FileCommand {
163163
}
164164
}
165165
Export-ModuleMember -Function @(
166-
'Remove-FileCommand',
166+
'Clear-FileCommand',
167167
'Write-Command',
168168
'Write-FileCommand'
169169
)

hugoalh.GitHubActionsToolkit/module/step-summary.psm1

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#Requires -Version 7.2
33
Import-Module -Name (
44
@(
5+
'command-base.psm1',
56
'utility.psm1'
67
) |
78
ForEach-Object -Process { Join-Path -Path $PSScriptRoot -ChildPath $_ }
@@ -261,11 +262,7 @@ Function Remove-StepSummary {
261262
[CmdletBinding(HelpUri = 'https://github.com/hugoalh-studio/ghactions-toolkit-powershell/wiki/api_function_remove-githubactionsstepsummary#Remove-GitHubActionsStepSummary')]
262263
[OutputType([Void])]
263264
Param ()
264-
If (!(Test-GitHubActionsEnvironment -StepSummary)) {
265-
Write-Error -Message 'Unable to get GitHub Actions step summary resources!' -Category 'ResourceUnavailable'
266-
Return
267-
}
268-
Remove-Item -LiteralPath $Env:GITHUB_STEP_SUMMARY -Confirm:$False -ErrorAction 'Continue'
265+
Clear-GitHubActionsFileCommand -Type 'StepSummary'
269266
}
270267
<#
271268
.SYNOPSIS

0 commit comments

Comments
 (0)