Skip to content

Commit b860d44

Browse files
author
Robin Stolpe
committed
changed/reverted param StopService & GithubActionsRunnerRegistrationUrl
Reverted StopService parameter back to string from bool and adjusted the changes in the rest of the code. Fixed parameter GitHubActionsRunnerRegistrationUrl so it's -like and not -notlike in the validation.
1 parent c14b886 commit b860d44

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

azure-self-hosted-runners/post-deployment-script.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ param (
66
# GitHub Actions Runner repository. E.g. "https://github.com/MY_ORG" (org-level) or "https://github.com/MY_ORG/MY_REPO" (repo-level)
77
# https://docs.github.com/en/actions/hosting-your-own-runners/adding-self-hosted-runners
88
[Parameter(Mandatory = $true)]
9-
[ValidateScript({ $_ -notlike "https://*" })]
9+
[ValidateScript({ $_ -like "https://*" })]
1010
[string]$GithubActionsRunnerRegistrationUrl,
1111

1212
[Parameter(Mandatory = $true, HelpMessage = "Name of the runner. Needs to be unique in the org/repo")]
1313
[ValidateNotNullOrEmpty()]
1414
[string]$GithubActionsRunnerName,
1515

1616
[Parameter(Mandatory = $false, HelpMessage = "Stop Service immediately (useful for spinning up runners preemptively)")]
17-
[bool]$StopService = $true,
17+
[string]$StopService = 'true',
1818

1919
[Parameter(Mandatory = $true, HelpMessage = "Path to the Actions Runner. Keep this path short to prevent Long Path issues, e.g. D:\a")]
2020
[ValidateNotNullOrEmpty()]
@@ -221,7 +221,7 @@ if ($null -eq (Get-Service -Name "actions.runner.*")) {
221221
}
222222

223223
# Immediately stop the service as we want to leave the VM in a deallocated state for later use. The service will automatically be started when Windows starts.
224-
if ($StopService -eq $true) {
224+
if ($StopService -eq 'true') {
225225
#Collects all running services named actions.runner.*
226226
$GetActionRunnerServices = Get-Service -Name "actions.runner.*" | Where-Object { $_.Status -eq 'Running' } | Select-Object -ExpandProperty Name
227227

0 commit comments

Comments
 (0)