From 7e0985b23de381a855c0cb7fed131649cf84257e Mon Sep 17 00:00:00 2001 From: Jan Calanog Date: Thu, 2 Oct 2025 10:37:04 +0200 Subject: [PATCH 1/4] Log changed file --- .github/workflows/preview-build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/preview-build.yml b/.github/workflows/preview-build.yml index 675c959b0..f72d0c80d 100644 --- a/.github/workflows/preview-build.yml +++ b/.github/workflows/preview-build.yml @@ -524,6 +524,7 @@ jobs: } const toLink = (file) => { + console.log('file', file); const path = file .replace('docs/', '') .replace('/index.md', '') From 5c9c1549d3a8734085c18690e229bafbaed63522 Mon Sep 17 00:00:00 2001 From: Jan Calanog Date: Thu, 2 Oct 2025 10:37:24 +0200 Subject: [PATCH 2/4] Tmp test --- docs/testing/index.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/testing/index.md b/docs/testing/index.md index 0319fce2d..4d2cebf71 100644 --- a/docs/testing/index.md +++ b/docs/testing/index.md @@ -2,6 +2,7 @@ The files in this directory are used for testing purposes. Do not edit these files unless you are working on tests. +test ###### [#synthetics-config-file] From db4bf441afc369bb702fb63f2898b8af0bd3139d Mon Sep 17 00:00:00 2001 From: Jan Calanog Date: Thu, 2 Oct 2025 10:44:12 +0200 Subject: [PATCH 3/4] Use regex replace to make sure only the correct parts are replaced --- .github/workflows/preview-build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/preview-build.yml b/.github/workflows/preview-build.yml index f72d0c80d..943d97f59 100644 --- a/.github/workflows/preview-build.yml +++ b/.github/workflows/preview-build.yml @@ -526,9 +526,9 @@ jobs: const toLink = (file) => { console.log('file', file); const path = file - .replace('docs/', '') - .replace('/index.md', '') - .replace('.md', ''); + .replace(/^docs\//, '') + .replace(/\/index.md$/, '') + .replace(/\.md$/, ''); return `[${file}](https://docs-v3-preview.elastic.dev${process.env.PATH_PREFIX}/${path})`; } From 7e48e4e547934a249709b8dbe7438c09d5c3c956 Mon Sep 17 00:00:00 2001 From: Jan Calanog Date: Thu, 2 Oct 2025 10:49:01 +0200 Subject: [PATCH 4/4] Cleanup --- .github/workflows/preview-build.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/preview-build.yml b/.github/workflows/preview-build.yml index 943d97f59..ea006e89a 100644 --- a/.github/workflows/preview-build.yml +++ b/.github/workflows/preview-build.yml @@ -523,8 +523,7 @@ jobs: return; } - const toLink = (file) => { - console.log('file', file); + const toMarkdownLink = (file) => { const path = file .replace(/^docs\//, '') .replace(/\/index.md$/, '') @@ -532,7 +531,7 @@ jobs: return `[${file}](https://docs-v3-preview.elastic.dev${process.env.PATH_PREFIX}/${path})`; } - const links = changedMdFiles.map(toLink) + const links = changedMdFiles.map(toMarkdownLink) const body = [ title,