Skip to content

Commit bad491a

Browse files
authored
Merge branch 'main' into feature/product_config
2 parents d4a2167 + 817a66f commit bad491a

File tree

3 files changed

+71
-23
lines changed

3 files changed

+71
-23
lines changed

.github/workflows/preview-build.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ jobs:
367367
env.MATCH == 'true'
368368
&& (
369369
!cancelled()
370+
&& github.repository != 'elastic/docs-builder'
370371
&& steps.docs-build.outputs.skip != 'true'
371372
&& (
372373
steps.deployment.outputs.result
@@ -377,12 +378,31 @@ jobs:
377378
)
378379
)
379380
uses: elastic/docs-builder/actions/validate-inbound-local@main
381+
382+
- name: 'Validate inbound links'
383+
if: >
384+
env.MATCH == 'true'
385+
&& (
386+
!cancelled()
387+
&& github.repository == 'elastic/docs-builder'
388+
&& steps.docs-build.outputs.skip != 'true'
389+
&& (
390+
steps.deployment.outputs.result
391+
|| (
392+
needs.check.outputs.any_modified == 'true'
393+
&& github.event_name == 'merge_group'
394+
)
395+
)
396+
)
397+
run: |
398+
dotnet run --project src/tooling/docs-builder -- inbound-links validate-link-reference
380399
381400
- name: 'Validate local path prefixes against those claimed by global navigation.yml'
382401
if: >
383402
env.MATCH == 'true'
384403
&& (
385404
!cancelled()
405+
&& github.repository != 'elastic/docs-builder'
386406
&& steps.docs-build.outputs.skip != 'true'
387407
&& (
388408
steps.deployment.outputs.result
@@ -393,6 +413,24 @@ jobs:
393413
)
394414
)
395415
uses: elastic/docs-builder/actions/validate-path-prefixes-local@main
416+
417+
- name: 'Validate local path prefixes against those claimed by global navigation.yml'
418+
if: >
419+
env.MATCH == 'true'
420+
&& (
421+
!cancelled()
422+
&& github.repository == 'elastic/docs-builder'
423+
&& steps.docs-build.outputs.skip != 'true'
424+
&& (
425+
steps.deployment.outputs.result
426+
|| (
427+
needs.check.outputs.any_modified == 'true'
428+
&& github.event_name == 'merge_group'
429+
)
430+
)
431+
)
432+
run: |
433+
dotnet run --project src/tooling/docs-builder -- path-prefixes validate-link-reference
396434
397435
- uses: elastic/docs-builder/.github/actions/aws-auth@main
398436
if: >

src/Elastic.Documentation.Site/Assets/web-components/SearchOrAskAi/SearchOrAskAiModal.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
EuiText,
1010
EuiHorizontalRule,
1111
useEuiOverflowScroll,
12+
EuiLink,
1213
} from '@elastic/eui'
1314
import { css } from '@emotion/react'
1415
import * as React from 'react'
@@ -85,11 +86,18 @@ export const SearchOrAskAiModal = () => {
8586
`}
8687
label="Beta"
8788
color="accent"
88-
tooltipContent="This feature is in beta. Got feedback? We'd love to hear it!"
89+
tooltipContent="This feature is in beta. It's only enabled if you are in Elastic's Global VPN."
8990
/>
9091

9192
<EuiText color="subdued" size="xs">
92-
This feature is in beta. Got feedback? We'd love to hear it!
93+
This feature is in beta.{' '}
94+
<EuiLink
95+
target="_blank"
96+
rel="noopener noreferrer"
97+
href="https://github.com/elastic/docs-eng-team/issues/new?template=search-or-ask-ai-feedback.yml"
98+
>
99+
Got feedback? We'd love to hear it!
100+
</EuiLink>
93101
</EuiText>
94102
</div>
95103
</div>

src/tooling/docs-builder/Cli/DiffCommands.cs

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -77,31 +77,33 @@ public async Task<int> ValidateRedirects(string? path = null, Cancel ctx = defau
7777
if (changed.Length != 0)
7878
_log.LogInformation("Found {Count} changes to files related to documentation in the current branch.", changed.Length);
7979

80-
var missingRedirects = changed
81-
.Where(c =>
82-
c.ChangeType is GitChangeType.Deleted or GitChangeType.Renamed
83-
&& !redirects.ContainsKey(c is RenamedGitChange renamed ? renamed.OldFilePath : c.FilePath)
84-
)
85-
.ToArray();
86-
87-
if (missingRedirects.Length != 0)
88-
{
89-
var relativeRedirectFile = Path.GetRelativePath(root.FullName, redirectFile.Source.FullName);
90-
_log.LogInformation("Found {Count} changes that still require updates to: {RedirectFile}", missingRedirects.Length, relativeRedirectFile);
91-
}
92-
93-
foreach (var notFound in missingRedirects)
80+
var deletedAndRenamed = changed.Where(c => c.ChangeType is GitChangeType.Deleted or GitChangeType.Renamed).ToArray();
81+
var missingCount = 0;
82+
foreach (var change in deletedAndRenamed)
9483
{
95-
if (notFound is RenamedGitChange renamed)
84+
var lookupPath = change is RenamedGitChange renamed ? renamed.OldFilePath : change.FilePath;
85+
var docSetRelativePath = Path.GetRelativePath(buildContext.DocumentationSourceDirectory.FullName, Path.Combine(root.FullName, lookupPath));
86+
var rootRelativePath = Path.GetRelativePath(root.FullName, Path.Combine(root.FullName, lookupPath));
87+
if (redirects.ContainsKey(docSetRelativePath))
88+
continue;
89+
if (redirects.ContainsKey(rootRelativePath))
9690
{
9791
collector.EmitError(redirectFile.Source,
98-
$"File '{renamed.OldFilePath}' was renamed to '{renamed.NewFilePath}' but it has no redirect configuration set.");
99-
}
100-
else if (notFound.ChangeType is GitChangeType.Deleted)
101-
{
102-
collector.EmitError(redirectFile.Source,
103-
$"File '{notFound.FilePath}' was deleted but it has no redirect targets. This will lead to broken links.");
92+
$"Redirect contains path relative to root '{rootRelativePath}' but should be relative to the documentation set '{docSetRelativePath}'");
93+
continue;
10494
}
95+
missingCount++;
96+
97+
if (change is RenamedGitChange rename)
98+
collector.EmitError(redirectFile.Source, $"Missing '{docSetRelativePath}' in redirects.yml. '{rename.OldFilePath}' was renamed to '{rename.NewFilePath}' but it has no redirect configuration set.");
99+
else if (change.ChangeType is GitChangeType.Deleted)
100+
collector.EmitError(redirectFile.Source, $"Missing '{docSetRelativePath}' in redirects.yml. '{change.FilePath}' was deleted but it has no redirect targets. This will lead to broken links.");
101+
}
102+
103+
if (missingCount != 0)
104+
{
105+
var relativeRedirectFile = Path.GetRelativePath(root.FullName, redirectFile.Source.FullName);
106+
_log.LogInformation("Found {Count} changes that still require updates to: {RedirectFile}", missingCount, relativeRedirectFile);
105107
}
106108

107109
await collector.StopAsync(ctx);

0 commit comments

Comments
 (0)