Skip to content

Commit

Permalink
Merge branch 'mwong-add-preview-link' into test-preview-link-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
mirnawong1 authored Sep 20, 2024
2 parents 2a04fd0 + 94d82f4 commit cc9d6f7
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions .github/workflows/preview-link.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,23 +98,14 @@ jobs:
CHANGED_FILES="${{ steps.files.outputs.changed_files }}"
if [ -z "$CHANGED_FILES" ]; then
echo "No documentation files were changed."
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: peter-evans/create-or-update-comment@v4
Expand Down

0 comments on commit cc9d6f7

Please sign in to comment.