From 47da51d85a91196d45b032a0b2668198b71c30d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mos=C3=A8=20Giordano?= Date: Wed, 10 Apr 2024 13:36:08 +0100 Subject: [PATCH] [CI] Do not rewrite links in symlinked files (#305) If we rewrite the hyperlinks in symlinked files we risk to accidentally append duplicate `${PREVIEW_SUBDIR}`, depending on the order with which `find` operates on the files. --- .github/workflows/docs.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 936c17e4..fdb6d4ab 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -75,7 +75,8 @@ jobs: echo "BASE_URL=${BASE_URL}" >> "${GITHUB_ENV}" PREVIEW_SUBDIR="preview/PR${{ github.event.number }}" echo "PREVIEW_SUBDIR=${PREVIEW_SUBDIR}" >> "${GITHUB_ENV}" - find . -name '*.md' -print -exec sed -i "s|${BASE_URL}|${BASE_URL}/${PREVIEW_SUBDIR}|g" '{}' \; + # Edit only files, and not symlinks, to avoid double editing the same files. + find . -type f -name '*.md' -print -exec sed -i "s|${BASE_URL}|${BASE_URL}/${PREVIEW_SUBDIR}|g" '{}' \; - name: Build docs run: |