Skip to content

Commit 2ca63c9

Browse files
authored
Fix preview links in comment (#1985)
* Log changed file * Tmp test * Use regex replace to make sure only the correct parts are replaced * Cleanup
1 parent 0598fec commit 2ca63c9

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

.github/workflows/preview-build.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -523,15 +523,15 @@ jobs:
523523
return;
524524
}
525525
526-
const toLink = (file) => {
526+
const toMarkdownLink = (file) => {
527527
const path = file
528-
.replace('docs/', '')
529-
.replace('/index.md', '')
530-
.replace('.md', '');
528+
.replace(/^docs\//, '')
529+
.replace(/\/index.md$/, '')
530+
.replace(/\.md$/, '');
531531
return `[${file}](https://docs-v3-preview.elastic.dev${process.env.PATH_PREFIX}/${path})`;
532532
}
533533
534-
const links = changedMdFiles.map(toLink)
534+
const links = changedMdFiles.map(toMarkdownLink)
535535
536536
const body = [
537537
title,

docs/testing/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
The files in this directory are used for testing purposes. Do not edit these files unless you are working on tests.
44

5+
test
56

67
###### [#synthetics-config-file]
78

0 commit comments

Comments
 (0)