re-registration fix

This commit is contained in:
mullayanov
2025-04-17 22:26:47 +05:00
parent 261d21b4aa
commit d17d9c2d6c
2 changed files with 17 additions and 8 deletions

View File

@@ -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
}