From ec8d39ae8de936bce5dd02eefa36b2562d43489d Mon Sep 17 00:00:00 2001 From: Felipe Cotti Date: Wed, 6 Aug 2025 11:43:23 -0300 Subject: [PATCH 1/9] Demo --- docs/_docset.yml | 3 +- docs/contribute/{move.md => move-new.md} | 0 docs/contribute/redirects.md | 165 ----------------------- 3 files changed, 1 insertion(+), 167 deletions(-) rename docs/contribute/{move.md => move-new.md} (100%) delete mode 100644 docs/contribute/redirects.md diff --git a/docs/_docset.yml b/docs/_docset.yml index 31b325c65..e151ede9e 100644 --- a/docs/_docset.yml +++ b/docs/_docset.yml @@ -34,8 +34,7 @@ toc: - file: index.md - file: locally.md - file: on-the-web.md - - file: move.md - - file: redirects.md + - file: move-new.md - file: cumulative-docs.md - file: branching-strategy.md - file: add-repo.md diff --git a/docs/contribute/move.md b/docs/contribute/move-new.md similarity index 100% rename from docs/contribute/move.md rename to docs/contribute/move-new.md diff --git a/docs/contribute/redirects.md b/docs/contribute/redirects.md deleted file mode 100644 index 086d3a811..000000000 --- a/docs/contribute/redirects.md +++ /dev/null @@ -1,165 +0,0 @@ ---- -navigation_title: "Redirects" ---- - -# Manage redirects across doc sets - -When you [move](move.md) or delete pages, other [documentation sets](../configure/content-set/index.md) might still link to them. This can lead to a chicken-and-egg problem: you can't publish your changes without breaking links elsewhere. - -Redirects let you map old links to new targets across documentation sets, so you can publish changes while updating other doc sets. - -## Limitations - -Redirects only work within Elastic Docs V3 content sets. You cannot use this method to redirect to external destinations like [API docs](https://www.elastic.co/docs/api/). - -For API redirects, consult with the documentation engineering team on Slack (#elastic-docs-v3). - -For elastic.co/guide redirects, open a [web team request](http://ela.st/web-request). - -## File location. - -Redirects are configured at the content set-level. -The configuration file should be located next to your `docset.yml` file: - -* `redirects.yml` if you use `docset.yml` -* `_redirects.yml` if you use `_docset.yml` - -## Syntax - -Example syntax: - -```yaml -redirects: - 'testing/redirects/4th-page.md': 'testing/redirects/5th-page.md' - 'testing/redirects/9th-page.md': '!testing/redirects/5th-page.md' - 'testing/redirects/6th-page.md': - 'testing/redirects/7th-page.md': - to: 'testing/redirects/5th-page.md' - anchors: '!' - 'testing/redirects/first-page-old.md': - to: 'testing/redirects/second-page.md' - anchors: - 'old-anchor': 'active-anchor' - 'removed-anchor': - 'testing/redirects/second-page-old.md': - many: - - to: "testing/redirects/second-page.md" - anchors: - "aa": "zz" - "removed-anchor": - - to: "testing/redirects/third-page.md" - anchors: - "bb": "yy" - 'testing/redirects/third-page.md': - anchors: - 'removed-anchor': - 'testing/redirects/cross-repo-page.md': 'other-repo://reference/section/new-cross-repo-page.md' - 'testing/redirects/8th-page.md': - to: 'other-repo://reference/section/new-cross-repo-page.md' - anchors: '!' - many: - - to: 'testing/redirects/second-page.md' - anchors: - 'item-a': 'yy' - - to: 'testing/redirects/third-page.md' - anchors: - 'item-b': - - -``` - -### Redirect preserving all anchors - -This example redirects `4th-page.md#anchor` to `5th-page.md#anchor`: - -```yaml -redirects: - 'testing/redirects/4th-page.md': 'testing/redirects/5th-page.md' -``` -### Redirect stripping all anchors - -This example strips all anchors from the source page. -Any remaining links resolving to anchors on `7th-page.md` will fail link validation. - -```yaml -redirects - 'testing/redirects/7th-page.md': - to: 'testing/redirects/5th-page.md' - anchors: '!' -``` - -Alternate syntax: - -```yaml -redirects: - 'testing/redirects/7th-page.md': '!testing/redirects/5th-page.md' -``` - -To handle removed anchors on a page that still exists, omit the `to:` field: - -```yaml - 'testing/redirects/third-page.md': - anchors: - 'removed-anchor': -``` - -### Redirect with renamed anchors - -This example redirects: - -- `first-page-old.md#old-anchor` → `second-page.md#active-anchor` -- `first-page-old.md#removed-anchor` → `second-page.md` -- Any other anchor is passed through and validated normally. - -```yaml -redirects: - 'testing/redirects/first-page-old.md': - to: 'testing/redirects/second-page.md' - anchors: - 'old-anchor': 'active-anchor' - 'removed-anchor': -``` - -### Redirecting to other repositories - -Use the `repo://path/to/page.md` syntax to redirect across repositories. - -```yaml -redirects: - 'testing/redirects/cross-repo-page.md': 'other-repo://reference/section/new-cross-repo-page.md' -``` - -### Managing complex scenarios with anchors - -* `to`, `anchor` and `many` can be used together to support more complex scenarios. -* Setting `to` at the top level determines the default case, which can be used for partial redirects. -* Cross-repository links are supported, with the same syntax as in the previous example. -* The existing rules for `anchors` also apply here. To define a catch-all redirect, use `{}`. - -```yaml -redirects: - # In this first scenario, the default redirection target remains the same page, with anchors being preserved. - # Omitting the ``anchors`` tag or explicitly setting it as empty are both supported. - 'testing/redirects/8th-page.md': - to: 'testing/redirects/8th-page.md' - many: - - to: 'testing/redirects/second-page.md' - anchors: - 'item-a': 'yy' - - to: 'testing/redirects/third-page.md' - anchors: - 'item-b': - - # In this scenario, the default redirection target is a different page, and anchors are dropped. - 'testing/redirects/deleted-page.md': - to: 'testing/redirects/5th-page.md' - anchors: '!' - many: - - to: "testing/redirects/second-page.md" - anchors: - "aa": "zz" - "removed-anchor": - - to: "other-repo://reference/section/partial-content.md" - anchors: - "bb": "yy" -``` From 92742b9fa8da515d1fa08636c771cf786aaebb8d Mon Sep 17 00:00:00 2001 From: Felipe Cotti Date: Wed, 6 Aug 2025 11:58:44 -0300 Subject: [PATCH 2/9] checking why it's apparently short-circuiting --- src/tooling/docs-builder/Cli/DiffCommands.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tooling/docs-builder/Cli/DiffCommands.cs b/src/tooling/docs-builder/Cli/DiffCommands.cs index 664e9fdbd..71d6db798 100644 --- a/src/tooling/docs-builder/Cli/DiffCommands.cs +++ b/src/tooling/docs-builder/Cli/DiffCommands.cs @@ -41,6 +41,7 @@ public async Task ValidateRedirects([Argument] string? path = null, Cancel var fs = new FileSystem(); var root = fs.DirectoryInfo.New(Paths.WorkingDirectoryRoot.FullName); + _log.LogInformation($"Initializing build context for redirect rule validation. Environment: {(runningOnCi ? "CI" : "Local")}, Lookup path: {path}"); var buildContext = new BuildContext(collector, fs, fs, configurationContext, ExportOptions.MetadataOnly, root.FullName, null); var sourceFile = buildContext.ConfigurationPath; var redirectFileName = sourceFile.Name.StartsWith('_') ? "_redirects.yml" : "redirects.yml"; From d9be3020e63f1e0d8099c5374aed8af415f21ffc Mon Sep 17 00:00:00 2001 From: Felipe Cotti Date: Wed, 6 Aug 2025 12:33:15 -0300 Subject: [PATCH 3/9] Checking --- .github/workflows/preview-build.yml | 50 +++++++++++++++++-- src/tooling/docs-builder/Cli/DiffCommands.cs | 2 +- .../IntegrationGitRepositoryTracker.cs | 17 +++++-- 3 files changed, 61 insertions(+), 8 deletions(-) diff --git a/.github/workflows/preview-build.yml b/.github/workflows/preview-build.yml index ff35ca016..59e14f241 100644 --- a/.github/workflows/preview-build.yml +++ b/.github/workflows/preview-build.yml @@ -117,10 +117,10 @@ jobs: outputs: any_modified: ${{ steps.check-files.outputs.any_modified }} all_changed_files: ${{ steps.check-files.outputs.all_changed_files }} - added_files: ${{ steps.check-files.outputs.added_files }} - modified_files: ${{ steps.check-files.outputs.modified_files }} - deleted_files: ${{ steps.check-files.outputs.deleted_files }} - renamed_files: ${{ steps.check-files.outputs.renamed_files }} + added_files: ${{ steps.check-modified-file-detail.outputs.added_files }} + modified_files: ${{ steps.check-modified-file-detail.outputs.modified_files }} + deleted_files: ${{ steps.check-modified-file-detail.outputs.deleted_files }} + renamed_files: ${{ steps.check-modified-file-detail.outputs.renamed_files }} steps: - name: Checkout if: contains(fromJSON('["push", "merge_group", "workflow_dispatch"]'), github.event_name) @@ -138,6 +138,48 @@ jobs: ${{ inputs.path-pattern-ignore != '' && inputs.path-pattern-ignore || '' }} .github/** README.md + - name: Get modified file detail + if: contains(fromJSON('["merge_group", "pull_request", "pull_request_target"]'), github.event_name) + id: check-modified-file-detail + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + with: + script: | + const { owner, repo } = context.repo; + const pull_number = context.payload.pull_request.number; + + const files = await github.paginate(github.rest.pulls.listFiles, { + owner, + repo, + pull_number, + }); + + const added = []; + const modified = []; + const deleted = []; + const renamed = []; + const all_changed = []; + + for (const file of files) { + switch (file.status) { + case 'added': + added.push(file.filename); + break; + case 'modified': + modified.push(file.filename); + break; + case 'removed': + deleted.push(file.filename); + break; + case 'renamed': + renamed.push(`${file.previous_filename}:${file.filename}`); + break; + } + } + + core.setOutput('added_files', added.join(' ')); + core.setOutput('modified_files', modified.join(' ')); + core.setOutput('deleted_files', deleted.join(' ')); + core.setOutput('renamed_files', renamed.join(' ')); build: if: github.event.repository.fork == false # Skip running the job on the fork itself (It still runs on PRs on the upstream from forks) diff --git a/src/tooling/docs-builder/Cli/DiffCommands.cs b/src/tooling/docs-builder/Cli/DiffCommands.cs index 71d6db798..acf5fc359 100644 --- a/src/tooling/docs-builder/Cli/DiffCommands.cs +++ b/src/tooling/docs-builder/Cli/DiffCommands.cs @@ -57,7 +57,7 @@ public async Task ValidateRedirects([Argument] string? path = null, Cancel return collector.Errors; } - IRepositoryTracker tracker = runningOnCi ? new IntegrationGitRepositoryTracker(path) : new LocalGitRepositoryTracker(collector, root, path); + IRepositoryTracker tracker = runningOnCi ? new IntegrationGitRepositoryTracker(logFactory.CreateLogger(), path) : new LocalGitRepositoryTracker(collector, root, path); var changed = tracker.GetChangedFiles() as GitChange[] ?? []; if (changed.Length > 0) diff --git a/src/tooling/docs-builder/Tracking/IntegrationGitRepositoryTracker.cs b/src/tooling/docs-builder/Tracking/IntegrationGitRepositoryTracker.cs index 04f83c840..d8c2f8c79 100644 --- a/src/tooling/docs-builder/Tracking/IntegrationGitRepositoryTracker.cs +++ b/src/tooling/docs-builder/Tracking/IntegrationGitRepositoryTracker.cs @@ -2,10 +2,13 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information +using Microsoft.Extensions.Logging; + namespace Documentation.Builder.Tracking; -public class IntegrationGitRepositoryTracker(string lookupPath) : IRepositoryTracker +public class IntegrationGitRepositoryTracker(ILogger logger, string lookupPath) : IRepositoryTracker { + private ILogger Log { get; } = logger; private string LookupPath { get; } = $"{lookupPath}/"; public IEnumerable GetChangedFiles() { @@ -13,7 +16,10 @@ public IEnumerable GetChangedFiles() if (!string.IsNullOrEmpty(deletedFiles)) { foreach (var file in deletedFiles.Split(' ', StringSplitOptions.RemoveEmptyEntries).Where(f => f.StartsWith(LookupPath))) + { + Log.LogInformation("Found {File} as deleted in integration build", file); yield return new GitChange(file, GitChangeType.Deleted); + } } var addedFiles = Environment.GetEnvironmentVariable("ADDED_FILES"); @@ -33,8 +39,13 @@ public IEnumerable GetChangedFiles() var renamedFiles = Environment.GetEnvironmentVariable("RENAMED_FILES"); if (!string.IsNullOrEmpty(renamedFiles)) { - foreach (var file in renamedFiles.Split(' ', StringSplitOptions.RemoveEmptyEntries).Where(f => f.StartsWith(LookupPath))) - yield return new RenamedGitChange(string.Empty, file, GitChangeType.Renamed); + foreach (var pair in renamedFiles.Split(' ', StringSplitOptions.RemoveEmptyEntries).Where(f => f.StartsWith(LookupPath))) + { + Log.LogInformation("Found {File} as renamed in integration build", pair); + var parts = pair.Split(':'); + if (parts.Length == 2) + yield return new RenamedGitChange(parts[0], parts[1], GitChangeType.Renamed); + } } } } From 8048f0d3199ce4dee9c604ec36882e972fb28712 Mon Sep 17 00:00:00 2001 From: Felipe Cotti Date: Wed, 6 Aug 2025 12:40:00 -0300 Subject: [PATCH 4/9] Short-circuit still going on --- src/tooling/docs-builder/Cli/DiffCommands.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/tooling/docs-builder/Cli/DiffCommands.cs b/src/tooling/docs-builder/Cli/DiffCommands.cs index acf5fc359..a59f65428 100644 --- a/src/tooling/docs-builder/Cli/DiffCommands.cs +++ b/src/tooling/docs-builder/Cli/DiffCommands.cs @@ -47,6 +47,7 @@ public async Task ValidateRedirects([Argument] string? path = null, Cancel var redirectFileName = sourceFile.Name.StartsWith('_') ? "_redirects.yml" : "redirects.yml"; var redirectFileInfo = sourceFile.FileSystem.FileInfo.New(Path.Combine(sourceFile.Directory!.FullName, redirectFileName)); + _log.LogInformation($"Parsing redirects file: {redirectFileInfo.FullName}"); var redirectFileParser = new RedirectFile(redirectFileInfo, buildContext); var redirects = redirectFileParser.Redirects; @@ -57,6 +58,7 @@ public async Task ValidateRedirects([Argument] string? path = null, Cancel return collector.Errors; } + _log.LogInformation("Initializing repository tracker"); IRepositoryTracker tracker = runningOnCi ? new IntegrationGitRepositoryTracker(logFactory.CreateLogger(), path) : new LocalGitRepositoryTracker(collector, root, path); var changed = tracker.GetChangedFiles() as GitChange[] ?? []; @@ -66,6 +68,7 @@ public async Task ValidateRedirects([Argument] string? path = null, Cancel foreach (var notFound in changed.DistinctBy(c => c.FilePath).Where(c => c.ChangeType is GitChangeType.Deleted or GitChangeType.Renamed && !redirects.ContainsKey(c is RenamedGitChange renamed ? renamed.OldFilePath : c.FilePath))) { + _log.LogInformation("Checking {FilePath}", notFound.FilePath); if (notFound is RenamedGitChange renamed) { collector.EmitError(redirectFileInfo.Name, From 7f1c0f200f2dcdce25fdc0b5b2acb4ee4529c8bd Mon Sep 17 00:00:00 2001 From: Felipe Cotti Date: Wed, 6 Aug 2025 12:43:37 -0300 Subject: [PATCH 5/9] debugging --- src/tooling/docs-builder/Cli/DiffCommands.cs | 3 --- .../docs-builder/Tracking/IntegrationGitRepositoryTracker.cs | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/tooling/docs-builder/Cli/DiffCommands.cs b/src/tooling/docs-builder/Cli/DiffCommands.cs index a59f65428..5f1116c94 100644 --- a/src/tooling/docs-builder/Cli/DiffCommands.cs +++ b/src/tooling/docs-builder/Cli/DiffCommands.cs @@ -41,13 +41,11 @@ public async Task ValidateRedirects([Argument] string? path = null, Cancel var fs = new FileSystem(); var root = fs.DirectoryInfo.New(Paths.WorkingDirectoryRoot.FullName); - _log.LogInformation($"Initializing build context for redirect rule validation. Environment: {(runningOnCi ? "CI" : "Local")}, Lookup path: {path}"); var buildContext = new BuildContext(collector, fs, fs, configurationContext, ExportOptions.MetadataOnly, root.FullName, null); var sourceFile = buildContext.ConfigurationPath; var redirectFileName = sourceFile.Name.StartsWith('_') ? "_redirects.yml" : "redirects.yml"; var redirectFileInfo = sourceFile.FileSystem.FileInfo.New(Path.Combine(sourceFile.Directory!.FullName, redirectFileName)); - _log.LogInformation($"Parsing redirects file: {redirectFileInfo.FullName}"); var redirectFileParser = new RedirectFile(redirectFileInfo, buildContext); var redirects = redirectFileParser.Redirects; @@ -58,7 +56,6 @@ public async Task ValidateRedirects([Argument] string? path = null, Cancel return collector.Errors; } - _log.LogInformation("Initializing repository tracker"); IRepositoryTracker tracker = runningOnCi ? new IntegrationGitRepositoryTracker(logFactory.CreateLogger(), path) : new LocalGitRepositoryTracker(collector, root, path); var changed = tracker.GetChangedFiles() as GitChange[] ?? []; diff --git a/src/tooling/docs-builder/Tracking/IntegrationGitRepositoryTracker.cs b/src/tooling/docs-builder/Tracking/IntegrationGitRepositoryTracker.cs index d8c2f8c79..84b83a9d2 100644 --- a/src/tooling/docs-builder/Tracking/IntegrationGitRepositoryTracker.cs +++ b/src/tooling/docs-builder/Tracking/IntegrationGitRepositoryTracker.cs @@ -13,6 +13,7 @@ public class IntegrationGitRepositoryTracker(ILogger GetChangedFiles() { var deletedFiles = Environment.GetEnvironmentVariable("DELETED_FILES") ?? string.Empty; + Log.LogInformation("Deleted files: {File} as deleted in integration build", deletedFiles); if (!string.IsNullOrEmpty(deletedFiles)) { foreach (var file in deletedFiles.Split(' ', StringSplitOptions.RemoveEmptyEntries).Where(f => f.StartsWith(LookupPath))) @@ -37,6 +38,7 @@ public IEnumerable GetChangedFiles() } var renamedFiles = Environment.GetEnvironmentVariable("RENAMED_FILES"); + Log.LogInformation("Renamed files: {File} as deleted in integration build", renamedFiles); if (!string.IsNullOrEmpty(renamedFiles)) { foreach (var pair in renamedFiles.Split(' ', StringSplitOptions.RemoveEmptyEntries).Where(f => f.StartsWith(LookupPath))) From 5eb16e8a77b653f5e6e092804cce859db2f5d1ca Mon Sep 17 00:00:00 2001 From: Felipe Cotti Date: Wed, 6 Aug 2025 12:51:19 -0300 Subject: [PATCH 6/9] Debugging --- src/tooling/docs-builder/Cli/DiffCommands.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/tooling/docs-builder/Cli/DiffCommands.cs b/src/tooling/docs-builder/Cli/DiffCommands.cs index 5f1116c94..334654e9e 100644 --- a/src/tooling/docs-builder/Cli/DiffCommands.cs +++ b/src/tooling/docs-builder/Cli/DiffCommands.cs @@ -57,7 +57,18 @@ public async Task ValidateRedirects([Argument] string? path = null, Cancel } IRepositoryTracker tracker = runningOnCi ? new IntegrationGitRepositoryTracker(logFactory.CreateLogger(), path) : new LocalGitRepositoryTracker(collector, root, path); - var changed = tracker.GetChangedFiles() as GitChange[] ?? []; + _log.LogInformation("Calling GetChangedFiles"); + GitChange[] changed = []; + try + { + changed = tracker.GetChangedFiles() as GitChange[] ?? []; + } + catch (Exception e) + { + _log.LogError(e, "Error while getting changed files"); + } + + _log.LogInformation("Finished GetChangedFiles"); if (changed.Length > 0) _log.LogInformation($"Found {changed.Length} changes to files related to documentation in the current branch."); From 185a03d888e4486c60469518711c226b6ec63d3c Mon Sep 17 00:00:00 2001 From: Felipe Cotti Date: Wed, 6 Aug 2025 12:55:54 -0300 Subject: [PATCH 7/9] Debugging --- src/tooling/docs-builder/Cli/DiffCommands.cs | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/src/tooling/docs-builder/Cli/DiffCommands.cs b/src/tooling/docs-builder/Cli/DiffCommands.cs index 334654e9e..c825bdf77 100644 --- a/src/tooling/docs-builder/Cli/DiffCommands.cs +++ b/src/tooling/docs-builder/Cli/DiffCommands.cs @@ -57,21 +57,10 @@ public async Task ValidateRedirects([Argument] string? path = null, Cancel } IRepositoryTracker tracker = runningOnCi ? new IntegrationGitRepositoryTracker(logFactory.CreateLogger(), path) : new LocalGitRepositoryTracker(collector, root, path); - _log.LogInformation("Calling GetChangedFiles"); - GitChange[] changed = []; - try - { - changed = tracker.GetChangedFiles() as GitChange[] ?? []; - } - catch (Exception e) - { - _log.LogError(e, "Error while getting changed files"); - } - - _log.LogInformation("Finished GetChangedFiles"); + var changed = tracker.GetChangedFiles(); - if (changed.Length > 0) - _log.LogInformation($"Found {changed.Length} changes to files related to documentation in the current branch."); + if (changed.Any()) + _log.LogInformation($"Found {changed.Count()} changes to files related to documentation in the current branch."); foreach (var notFound in changed.DistinctBy(c => c.FilePath).Where(c => c.ChangeType is GitChangeType.Deleted or GitChangeType.Renamed && !redirects.ContainsKey(c is RenamedGitChange renamed ? renamed.OldFilePath : c.FilePath))) From 3377725da3b3a0dc81ccbb996502f8a976c29cad Mon Sep 17 00:00:00 2001 From: Felipe Cotti Date: Wed, 6 Aug 2025 15:00:00 -0300 Subject: [PATCH 8/9] aha! --- src/tooling/docs-builder/Cli/DiffCommands.cs | 5 +---- .../Tracking/IntegrationGitRepositoryTracker.cs | 7 +------ 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/tooling/docs-builder/Cli/DiffCommands.cs b/src/tooling/docs-builder/Cli/DiffCommands.cs index c825bdf77..5b3821dfb 100644 --- a/src/tooling/docs-builder/Cli/DiffCommands.cs +++ b/src/tooling/docs-builder/Cli/DiffCommands.cs @@ -65,13 +65,10 @@ public async Task ValidateRedirects([Argument] string? path = null, Cancel foreach (var notFound in changed.DistinctBy(c => c.FilePath).Where(c => c.ChangeType is GitChangeType.Deleted or GitChangeType.Renamed && !redirects.ContainsKey(c is RenamedGitChange renamed ? renamed.OldFilePath : c.FilePath))) { - _log.LogInformation("Checking {FilePath}", notFound.FilePath); if (notFound is RenamedGitChange renamed) { collector.EmitError(redirectFileInfo.Name, - runningOnCi - ? $"A file was renamed to '{renamed.NewFilePath}' but it has no redirect configuration set." - : $"File '{renamed.OldFilePath}' was renamed to '{renamed.NewFilePath}' but it has no redirect configuration set."); + $"File '{renamed.OldFilePath}' was renamed to '{renamed.NewFilePath}' but it has no redirect configuration set."); } else if (notFound.ChangeType is GitChangeType.Deleted) { diff --git a/src/tooling/docs-builder/Tracking/IntegrationGitRepositoryTracker.cs b/src/tooling/docs-builder/Tracking/IntegrationGitRepositoryTracker.cs index 84b83a9d2..8ae0946ff 100644 --- a/src/tooling/docs-builder/Tracking/IntegrationGitRepositoryTracker.cs +++ b/src/tooling/docs-builder/Tracking/IntegrationGitRepositoryTracker.cs @@ -6,19 +6,16 @@ namespace Documentation.Builder.Tracking; -public class IntegrationGitRepositoryTracker(ILogger logger, string lookupPath) : IRepositoryTracker +public class IntegrationGitRepositoryTracker(string lookupPath) : IRepositoryTracker { - private ILogger Log { get; } = logger; private string LookupPath { get; } = $"{lookupPath}/"; public IEnumerable GetChangedFiles() { var deletedFiles = Environment.GetEnvironmentVariable("DELETED_FILES") ?? string.Empty; - Log.LogInformation("Deleted files: {File} as deleted in integration build", deletedFiles); if (!string.IsNullOrEmpty(deletedFiles)) { foreach (var file in deletedFiles.Split(' ', StringSplitOptions.RemoveEmptyEntries).Where(f => f.StartsWith(LookupPath))) { - Log.LogInformation("Found {File} as deleted in integration build", file); yield return new GitChange(file, GitChangeType.Deleted); } } @@ -38,12 +35,10 @@ public IEnumerable GetChangedFiles() } var renamedFiles = Environment.GetEnvironmentVariable("RENAMED_FILES"); - Log.LogInformation("Renamed files: {File} as deleted in integration build", renamedFiles); if (!string.IsNullOrEmpty(renamedFiles)) { foreach (var pair in renamedFiles.Split(' ', StringSplitOptions.RemoveEmptyEntries).Where(f => f.StartsWith(LookupPath))) { - Log.LogInformation("Found {File} as renamed in integration build", pair); var parts = pair.Split(':'); if (parts.Length == 2) yield return new RenamedGitChange(parts[0], parts[1], GitChangeType.Renamed); From 77025c1ec4ad963ae141177cacb1c3d4fe4ae489 Mon Sep 17 00:00:00 2001 From: Felipe Cotti Date: Wed, 6 Aug 2025 15:02:33 -0300 Subject: [PATCH 9/9] fix --- src/tooling/docs-builder/Cli/DiffCommands.cs | 2 +- .../docs-builder/Tracking/IntegrationGitRepositoryTracker.cs | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/tooling/docs-builder/Cli/DiffCommands.cs b/src/tooling/docs-builder/Cli/DiffCommands.cs index 5b3821dfb..b3b2ba26d 100644 --- a/src/tooling/docs-builder/Cli/DiffCommands.cs +++ b/src/tooling/docs-builder/Cli/DiffCommands.cs @@ -56,7 +56,7 @@ public async Task ValidateRedirects([Argument] string? path = null, Cancel return collector.Errors; } - IRepositoryTracker tracker = runningOnCi ? new IntegrationGitRepositoryTracker(logFactory.CreateLogger(), path) : new LocalGitRepositoryTracker(collector, root, path); + IRepositoryTracker tracker = runningOnCi ? new IntegrationGitRepositoryTracker(path) : new LocalGitRepositoryTracker(collector, root, path); var changed = tracker.GetChangedFiles(); if (changed.Any()) diff --git a/src/tooling/docs-builder/Tracking/IntegrationGitRepositoryTracker.cs b/src/tooling/docs-builder/Tracking/IntegrationGitRepositoryTracker.cs index 8ae0946ff..81c2718d2 100644 --- a/src/tooling/docs-builder/Tracking/IntegrationGitRepositoryTracker.cs +++ b/src/tooling/docs-builder/Tracking/IntegrationGitRepositoryTracker.cs @@ -15,9 +15,7 @@ public IEnumerable GetChangedFiles() if (!string.IsNullOrEmpty(deletedFiles)) { foreach (var file in deletedFiles.Split(' ', StringSplitOptions.RemoveEmptyEntries).Where(f => f.StartsWith(LookupPath))) - { yield return new GitChange(file, GitChangeType.Deleted); - } } var addedFiles = Environment.GetEnvironmentVariable("ADDED_FILES");