Skip to content

Commit

Permalink
remove unknown offline runners from orgs
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticroentgen committed Jul 27, 2024
1 parent 108e8f8 commit 445f850
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion PoolManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,13 @@ private async Task CleanUpRunners(List<GithubTargetConfiguration> targetConfigs)
var runner = await db.Runners.Include(x => x.Lifecycle).FirstOrDefaultAsync(x => x.Hostname == runnerToRemove.Name);
if (runner == null)
{
_logger.LogWarning($"Found offline runner on GitHub not on record: {runnerToRemove.Name}");
_logger.LogWarning($"Found offline runner on GitHub not on record: {runnerToRemove.Name} - Removing");
bool f = githubTarget.Target switch
{
TargetType.Organization => await GitHubApi.RemoveRunnerFromOrg(githubTarget.Name, githubTarget.GitHubToken, runnerToRemove.Id),
TargetType.Repository => await GitHubApi.RemoveRunnerFromRepo(githubTarget.Name, githubTarget.GitHubToken, runnerToRemove.Id),
_ => throw new ArgumentOutOfRangeException()
};
continue;
}

Expand Down

0 comments on commit 445f850

Please sign in to comment.