From d59c34b6e11c39b6b0d5f0ef379fae7c90e4e601 Mon Sep 17 00:00:00 2001 From: mirnawong1 Date: Fri, 20 Sep 2024 17:31:10 +0100 Subject: [PATCH] add --- .github/workflows/preview-link.yml | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/.github/workflows/preview-link.yml b/.github/workflows/preview-link.yml index 714464cf9ee..4353f20f080 100644 --- a/.github/workflows/preview-link.yml +++ b/.github/workflows/preview-link.yml @@ -101,20 +101,10 @@ jobs: echo "No changed files found in the specified directories." LINKS="- No documentation files were changed." else - LINKS="" - for FILE in $CHANGED_FILES; do - # Remove 'website/docs/' prefix and '.md' extension - FILE_PATH="${FILE#website/docs/}" - FILE_PATH="${FILE_PATH%.md}" - # Replace spaces and special characters with hyphens in URL path - URL_PATH=$(echo "$FILE_PATH" | sed 's/ /-/g; s/[^a-zA-Z0-9\-_\/]//g' | tr '[:upper:]' '[:lower:]') - FULL_URL="$DEPLOYMENT_URL/$URL_PATH" - LINKS="$LINKS\n- [$FULL_URL]($FULL_URL)" - done + LINKS=$(echo "$CHANGED_FILES" | sed 's#website/docs/docs/##; s/.md$//' | awk -v url="$DEPLOYMENT_URL" '{print "- [" $0 "](" url "/docs/" $0 ")"}') fi - # Output the links - echo -e "links=$LINKS" >> $GITHUB_OUTPUT + echo "links=$LINKS" >> $GITHUB_OUTPUT - name: Post comment with deployment link uses: actions/github-script@v6