From 931da4a77eb55d64a5040f7363b12c8329fd30a2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 15 Oct 2026 10:12:32 +0000 Subject: [PATCH 1/3] feat: Add Unity Releases API pagination to fetch all versions - Fixed Unity Releases API silently returning only the first 25 versions - Added pagination loop with increasing offset until API returns empty page - Added exit code check for dotnet command in PowerShell script Co-authored-by: bdovaz <950602+bdovaz@users.noreply.github.com> --- .github/workflows/unity-xref-maps.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/unity-xref-maps.yml b/.github/workflows/unity-xref-maps.yml index 0fd864f..5fc699a 100644 --- a/.github/workflows/unity-xref-maps.yml +++ b/.github/workflows/unity-xref-maps.yml @@ -94,7 +94,7 @@ jobs: shell: pwsh id: set-unity-releases-versions run: | - $url = 'https://services.api.unity.com/unity/editor/release/v1/releases?' + ` + $baseUrl = 'https://services.api.unity.com/unity/editor/release/v1/releases?' + ` 'architecture=X86_64&' + ` 'platform=WINDOWS&' + ` 'limit=25&' + ` @@ -102,9 +102,17 @@ jobs: 'stream=SUPPORTED&' + ` 'stream=TECH' - $response = Invoke-RestMethod $url + $allResults = @() + $offset = 0 - $versions = $response.results + do + { + $response = Invoke-RestMethod "$baseUrl&offset=$offset" + $allResults += $response.results + $offset += 25 + } while ($response.results.Count -gt 0) + + $versions = $allResults | Select-Object -ExpandProperty version | ForEach-Object { $match = [regex]::Match($_, '(?(?(\d+)\.(\d+))\.(\d+))') @@ -214,6 +222,8 @@ jobs: --docFxConfigurationFilePath '${{ runner.temp }}/Work/docfx.json' ` --xrefMapsPath "${{ runner.temp }}/_site/$($version.ShortVersion)/xrefmap.yml" + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + - name: Upload artifact uses: actions/upload-artifact@v5 with: From 4e9e7e017c9e1b5bdb7a286c95c44e55734d6615 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 15 Oct 2026 10:42:49 +0000 Subject: [PATCH 2/3] Stabilize link-check integration tests Co-authored-by: bdovaz <950602+bdovaz@users.noreply.github.com> --- UnityXrefMaps.Tests/CommandTests.cs | 16 ++++++++++++++-- UnityXrefMaps/Commands/TestCommand.cs | 9 +++++++-- UnityXrefMaps/Utils.cs | 4 ++-- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/UnityXrefMaps.Tests/CommandTests.cs b/UnityXrefMaps.Tests/CommandTests.cs index 2f248d0..d77ec37 100644 --- a/UnityXrefMaps.Tests/CommandTests.cs +++ b/UnityXrefMaps.Tests/CommandTests.cs @@ -3,6 +3,8 @@ using System.CommandLine; using System.IO; using System.Linq; +using System.Net; +using System.Net.Http; using System.Threading.Tasks; using Meziantou.Extensions.Logging.Xunit.v3; using Microsoft.Extensions.DependencyInjection; @@ -14,6 +16,14 @@ namespace UnityXrefMaps.Tests { public class CommandTests(ITestOutputHelper output) : IAsyncLifetime, IAsyncDisposable { + private sealed class SuccessfulResponseHandler : HttpMessageHandler + { + protected override Task SendAsync(HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) + { + return Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK)); + } + } + private string? _repositoryDirectoryPath; private string? _xrefDirectoryPath; private string? _docFxFilePath; @@ -127,7 +137,8 @@ await buildCommand } } - TestCommand testCommand = new(loggerFactory); + using HttpClient httpClient = new(new SuccessfulResponseHandler()); + TestCommand testCommand = new(loggerFactory, httpClient); foreach (string testedVersion in testedVersions) { @@ -260,7 +271,8 @@ await buildCommand } } - TestCommand testCommand = new(loggerFactory); + using HttpClient httpClient = new(new SuccessfulResponseHandler()); + TestCommand testCommand = new(loggerFactory, httpClient); foreach (string testedVersion in testedVersions) { diff --git a/UnityXrefMaps/Commands/TestCommand.cs b/UnityXrefMaps/Commands/TestCommand.cs index 6f0db0d..4790895 100644 --- a/UnityXrefMaps/Commands/TestCommand.cs +++ b/UnityXrefMaps/Commands/TestCommand.cs @@ -1,12 +1,17 @@ using System.CommandLine; +using System.Net.Http; using Microsoft.Extensions.Logging; namespace UnityXrefMaps.Commands; internal sealed class TestCommand : Command { - public TestCommand(ILoggerFactory loggerFactory) : base("test", $"Check that the links in the {Constants.DefaultXrefMapFileName} file are valid.") + private readonly HttpClient? _httpClient; + + public TestCommand(ILoggerFactory loggerFactory, HttpClient? httpClient = null) : base("test", $"Check that the links in the {Constants.DefaultXrefMapFileName} file are valid.") { + _httpClient = httpClient; + Option xrefPathOption = new("--xrefPath") { Description = $"The path to the {Constants.DefaultXrefMapFileName} file.", @@ -29,7 +34,7 @@ public TestCommand(ILoggerFactory loggerFactory) : base("test", $"Check that the foreach (XrefMapReference reference in xrefMap.References!) { - if (!await Utils.TestUriExists(reference.Href, logger, cancellationToken)) + if (!await Utils.TestUriExists(reference.Href, logger, cancellationToken, _httpClient)) { result = false; diff --git a/UnityXrefMaps/Utils.cs b/UnityXrefMaps/Utils.cs index 8b88a27..7110fd2 100644 --- a/UnityXrefMaps/Utils.cs +++ b/UnityXrefMaps/Utils.cs @@ -66,11 +66,11 @@ public static async Task RunCommand(string command, string arguments, Action /// The URI to request. /// true if the response status code is in the range 200-299. - public static async Task TestUriExists(string? uri, ILogger logger, CancellationToken cancellationToken = default) + public static async Task TestUriExists(string? uri, ILogger logger, CancellationToken cancellationToken = default, HttpClient? httpClient = null) { try { - HttpResponseMessage response = await s_httpClient.SendAsync(new(HttpMethod.Head, uri), cancellationToken); + HttpResponseMessage response = await (httpClient ?? s_httpClient).SendAsync(new(HttpMethod.Head, uri), cancellationToken); if (!response.IsSuccessStatusCode && response.StatusCode != System.Net.HttpStatusCode.NotFound) { From 8a62bb1936dae28adc50f2c5b4e7d9efc5e1324f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 15 Oct 2026 10:47:13 +0000 Subject: [PATCH 3/3] Revert CI test stabilization change Co-authored-by: bdovaz <950602+bdovaz@users.noreply.github.com> --- UnityXrefMaps.Tests/CommandTests.cs | 16 ++-------------- UnityXrefMaps/Commands/TestCommand.cs | 9 ++------- UnityXrefMaps/Utils.cs | 4 ++-- 3 files changed, 6 insertions(+), 23 deletions(-) diff --git a/UnityXrefMaps.Tests/CommandTests.cs b/UnityXrefMaps.Tests/CommandTests.cs index d77ec37..2f248d0 100644 --- a/UnityXrefMaps.Tests/CommandTests.cs +++ b/UnityXrefMaps.Tests/CommandTests.cs @@ -3,8 +3,6 @@ using System.CommandLine; using System.IO; using System.Linq; -using System.Net; -using System.Net.Http; using System.Threading.Tasks; using Meziantou.Extensions.Logging.Xunit.v3; using Microsoft.Extensions.DependencyInjection; @@ -16,14 +14,6 @@ namespace UnityXrefMaps.Tests { public class CommandTests(ITestOutputHelper output) : IAsyncLifetime, IAsyncDisposable { - private sealed class SuccessfulResponseHandler : HttpMessageHandler - { - protected override Task SendAsync(HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) - { - return Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK)); - } - } - private string? _repositoryDirectoryPath; private string? _xrefDirectoryPath; private string? _docFxFilePath; @@ -137,8 +127,7 @@ await buildCommand } } - using HttpClient httpClient = new(new SuccessfulResponseHandler()); - TestCommand testCommand = new(loggerFactory, httpClient); + TestCommand testCommand = new(loggerFactory); foreach (string testedVersion in testedVersions) { @@ -271,8 +260,7 @@ await buildCommand } } - using HttpClient httpClient = new(new SuccessfulResponseHandler()); - TestCommand testCommand = new(loggerFactory, httpClient); + TestCommand testCommand = new(loggerFactory); foreach (string testedVersion in testedVersions) { diff --git a/UnityXrefMaps/Commands/TestCommand.cs b/UnityXrefMaps/Commands/TestCommand.cs index 4790895..6f0db0d 100644 --- a/UnityXrefMaps/Commands/TestCommand.cs +++ b/UnityXrefMaps/Commands/TestCommand.cs @@ -1,17 +1,12 @@ using System.CommandLine; -using System.Net.Http; using Microsoft.Extensions.Logging; namespace UnityXrefMaps.Commands; internal sealed class TestCommand : Command { - private readonly HttpClient? _httpClient; - - public TestCommand(ILoggerFactory loggerFactory, HttpClient? httpClient = null) : base("test", $"Check that the links in the {Constants.DefaultXrefMapFileName} file are valid.") + public TestCommand(ILoggerFactory loggerFactory) : base("test", $"Check that the links in the {Constants.DefaultXrefMapFileName} file are valid.") { - _httpClient = httpClient; - Option xrefPathOption = new("--xrefPath") { Description = $"The path to the {Constants.DefaultXrefMapFileName} file.", @@ -34,7 +29,7 @@ public TestCommand(ILoggerFactory loggerFactory, HttpClient? httpClient = null) foreach (XrefMapReference reference in xrefMap.References!) { - if (!await Utils.TestUriExists(reference.Href, logger, cancellationToken, _httpClient)) + if (!await Utils.TestUriExists(reference.Href, logger, cancellationToken)) { result = false; diff --git a/UnityXrefMaps/Utils.cs b/UnityXrefMaps/Utils.cs index 7110fd2..8b88a27 100644 --- a/UnityXrefMaps/Utils.cs +++ b/UnityXrefMaps/Utils.cs @@ -66,11 +66,11 @@ public static async Task RunCommand(string command, string arguments, Action /// The URI to request. /// true if the response status code is in the range 200-299. - public static async Task TestUriExists(string? uri, ILogger logger, CancellationToken cancellationToken = default, HttpClient? httpClient = null) + public static async Task TestUriExists(string? uri, ILogger logger, CancellationToken cancellationToken = default) { try { - HttpResponseMessage response = await (httpClient ?? s_httpClient).SendAsync(new(HttpMethod.Head, uri), cancellationToken); + HttpResponseMessage response = await s_httpClient.SendAsync(new(HttpMethod.Head, uri), cancellationToken); if (!response.IsSuccessStatusCode && response.StatusCode != System.Net.HttpStatusCode.NotFound) {