Skip to content

Commit 4ad1c1f

Browse files
committed
Add function Get-WorkflowRunUri
1 parent b416b33 commit 4ad1c1f

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ Import-Module -Name 'hugoalh.GitHubActionsToolkit' -Prefix 'GitHubActions' -Scop
6060
- `Get-GitHubActionsState`
6161
- `Get-GitHubActionsStepSummary`
6262
- `Get-GitHubActionsWebhookEventPayload`
63+
- `Get-GitHubActionsWorkflowRunUri`
6364
- `Remove-GitHubActionsProblemMatcher`
6465
- `Remove-GitHubActionsStepSummary`
6566
- `Set-GitHubActionsEnvironmentVariable`

hugoalh.GitHubActionsToolkit/hugoalh.GitHubActionsToolkit.psd1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
'Get-State',
7878
'Get-StepSummary',
7979
'Get-WebhookEventPayload',
80+
'Get-WorkflowRunUri',
8081
'Remove-ProblemMatcher',
8182
'Remove-StepSummary',
8283
'Set-EnvironmentVariable',
@@ -138,6 +139,7 @@
138139
'Get-Payload',
139140
'Get-WebhookEvent',
140141
'Get-WebhookPayload',
142+
'Get-WorkflowRunUrl',
141143
'Restore-State',
142144
'Save-State',
143145
'Set-Env',

hugoalh.GitHubActionsToolkit/module/utility.psm1

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,21 @@ Set-Alias -Name 'Get-WebhookEvent' -Value 'Get-WebhookEventPayload' -Option 'Rea
8989
Set-Alias -Name 'Get-WebhookPayload' -Value 'Get-WebhookEventPayload' -Option 'ReadOnly' -Scope 'Local'
9090
<#
9191
.SYNOPSIS
92+
GitHub Actions - Get Workflow Run URI
93+
.DESCRIPTION
94+
Get the workflow run's URI.
95+
.OUTPUTS
96+
String
97+
#>
98+
function Get-WorkflowRunUri {
99+
[CmdletBinding(HelpUri = 'https://github.com/hugoalh-studio/ghactions-toolkit-powershell/wiki/api_function_get-githubactionsworkflowrunuri#Get-GitHubActionsWorkflowRunUri')]
100+
[OutputType([String])]
101+
param ()
102+
return "$env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY/actions/runs/$env:GITHUB_RUN_ID"
103+
}
104+
Set-Alias -Name 'Get-WorkflowRunUrl' -Value 'Get-WorkflowRunUri' -Option 'ReadOnly' -Scope 'Local'
105+
<#
106+
.SYNOPSIS
92107
GitHub Actions - Test Environment
93108
.DESCRIPTION
94109
Test the current process whether is executing inside the GitHub Actions environment.
@@ -148,12 +163,14 @@ Export-ModuleMember -Function @(
148163
'Add-SecretMask',
149164
'Get-IsDebug',
150165
'Get-WebhookEventPayload',
166+
'Get-WorkflowRunUri',
151167
'Test-Environment'
152168
) -Alias @(
153169
'Add-Mask',
154170
'Add-Secret',
155171
'Get-Event',
156172
'Get-Payload',
157173
'Get-WebhookEvent',
158-
'Get-WebhookPayload'
174+
'Get-WebhookPayload',
175+
'Get-WorkflowRunUrl'
159176
)

0 commit comments

Comments
 (0)