re-registration fix
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
# Set the labels if given
|
||||
if ($null -ne $env:GITEA_RUNNER_LABELS) {
|
||||
$LABELS = $env:GITEA_RUNNER_LABELS
|
||||
$LABELS = $env:GITEA_RUNNER_LABELS
|
||||
} else {
|
||||
$LABELS = 'windows:host'
|
||||
$LABELS = 'windows:host,windows-msbuild:host'
|
||||
}
|
||||
|
||||
$GITEA_RUNNER_NAME = $env:GITEA_RUNNER_NAME
|
||||
@@ -10,13 +10,19 @@ $GITEA_INSTANCE_URL = $env:GITEA_INSTANCE_URL
|
||||
$GITEA_RUNNER_REGISTRATION_TOKEN = $env:GITEA_RUNNER_REGISTRATION_TOKEN
|
||||
|
||||
try {
|
||||
Write-Host "Configuring runner: $GITEA_RUNNER_NAME"
|
||||
./act_runner.exe register --no-interactive --instance $GITEA_INSTANCE_URL --token $GITEA_RUNNER_REGISTRATION_TOKEN --name $GITEA_RUNNER_NAME --labels $LABELS
|
||||
Push-Location "data"
|
||||
|
||||
# Check if runner is already registered
|
||||
if (-not (Test-Path -Path "data/.runner")) {
|
||||
Write-Host "Configuring new runner: $GITEA_RUNNER_NAME"
|
||||
../act_runner.exe register --no-interactive --instance $GITEA_INSTANCE_URL --token $GITEA_RUNNER_REGISTRATION_TOKEN --name $GITEA_RUNNER_NAME --labels $LABELS
|
||||
}
|
||||
|
||||
# Remove access token for security reasons
|
||||
$env:ACCESS_TOKEN=$null
|
||||
|
||||
./act_runner.exe daemon
|
||||
# Remove registration token for security reasons
|
||||
$env:GITEA_RUNNER_REGISTRATION_TOKEN=$null
|
||||
|
||||
../act_runner.exe daemon
|
||||
} catch {
|
||||
Write-Error $_.Exception.Message
|
||||
Write-Error $_.Exception.Message
|
||||
}
|
||||
Reference in New Issue
Block a user