Skip to content

Commit

Permalink
allow for single self-hosted labels
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticroentgen committed Apr 16, 2024
1 parent f246d87 commit be621e1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,11 @@ public static void Main(string[] args)
List<string?> labels = workflowJson.GetProperty("labels").EnumerateArray()
.Select(x => x.GetString()).ToList();
if (!labels.Contains("self-hosted"))
bool isSelfHosted = labels.Any(x => x.StartsWith("self-hosted"));
if (!isSelfHosted)
{
logger.LogInformation("Received a non self-hosted request. Ignoring.");
logger.LogInformation($"Received a non self-hosted request. Ignoring. Labels: {string.Join('|', labels)}");
return;
}
Expand Down Expand Up @@ -159,19 +161,19 @@ public static void Main(string[] args)
foreach (var csize in Config.Sizes)
{
if (csize.Arch == "x64" && labels.Contains(csize.Name))
if (csize.Arch == "x64" && (labels.Contains(csize.Name) || labels.Contains($"self-hosted-{csize.Name}")))
{
size = csize.Name;
arch = csize.Arch;
break;
}
if (csize.Arch == "x64" && labels.Contains($"{csize.Name}-x64"))
if (csize.Arch == "x64" && (labels.Contains($"{csize.Name}-x64")|| labels.Contains($"self-hosted-{csize.Name}-x64")))
{
size = csize.Name;
arch = csize.Arch;
break;
}
if (csize.Arch == "arm64" && labels.Contains($"{csize.Name}-arm64"))
if (csize.Arch == "arm64" && (labels.Contains($"{csize.Name}-arm64")|| labels.Contains($"self-hosted-{csize.Name}-arm64")))
{
size = csize.Name;
arch = csize.Arch;
Expand Down

0 comments on commit be621e1

Please sign in to comment.