Skip to content

Commit

Permalink
add
Browse files Browse the repository at this point in the history
  • Loading branch information
mirnawong1 committed Sep 20, 2024
1 parent b7fc7e2 commit b050146
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 11 deletions.
42 changes: 31 additions & 11 deletions .github/workflows/preview-link.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ jobs:
echo "deployment_url=$DEPLOYMENT_URL" >> $GITHUB_OUTPUT
- name: Wait for deployment to be accessible (optional)
- name: Wait for deployment to be accessible
id: wait_for_deployment
run: |
DEPLOYMENT_URL="${{ steps.vercel_url.outputs.deployment_url }}"
echo "Waiting for deployment at $DEPLOYMENT_URL to become accessible..."
MAX_ATTEMPTS=30 # Adjust as needed
SLEEP_TIME=10 # Adjust as needed
MAX_ATTEMPTS=60 # Adjust as needed (e.g., wait up to 10 minutes)
SLEEP_TIME=10 # Check every 10 seconds
ATTEMPTS=0
while [ $ATTEMPTS -lt $MAX_ATTEMPTS ]; do
Expand All @@ -76,8 +76,20 @@ jobs:
- name: Get changed files
id: files
run: |
CHANGED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep 'website/docs/docs/')
echo "changed_files=$CHANGED_FILES" >> $GITHUB_OUTPUT
# Get the list of changed files in the specified directories
CHANGED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep -E '^website/docs/(docs|best-practices|guides|faqs|reference)/.*\.md$' || true)
echo "Changed files:"
echo "$CHANGED_FILES"
# Check if any files were changed
if [ -z "$CHANGED_FILES" ]; then
echo "No documentation files were changed."
echo "changed_files=" >> $GITHUB_OUTPUT
else
# Convert line-separated files to space-separated for easier handling
CHANGED_FILES="$(echo "$CHANGED_FILES" | tr '\n' ' ')"
echo "changed_files=$CHANGED_FILES" >> $GITHUB_OUTPUT
fi
- name: Generate file preview links
id: links
Expand All @@ -86,21 +98,29 @@ jobs:
CHANGED_FILES="${{ steps.files.outputs.changed_files }}"
if [ -z "$CHANGED_FILES" ]; then
echo "No changed files found in the specified directories."
echo "No documentation files were changed."
LINKS="- No documentation files were changed."
else
LINKS=$(echo "$CHANGED_FILES" | sed 's#website/docs/docs/##; s/.md$//' | awk -v url="$DEPLOYMENT_URL" '{print "- [" $0 "](" url "/docs/" $0 ")"}')
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
fi
echo "links=$LINKS" >> $GITHUB_OUTPUT
# Output the links
echo -e "links=$LINKS" >> $GITHUB_OUTPUT
- name: Post comment with deployment link
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body: |
🚀 **Deployment available:** ${{ steps.vercel_url.outputs.deployment_url }}
Here are the direct links to the updated files:
🚀 Deployment available! Here are the direct links to the updated files:
${{ steps.links.outputs.links }}
2 changes: 2 additions & 0 deletions website/docs/docs/build/saved-queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ sidebar_label: "Saved queries"
tags: [Metrics, Semantic Layer]
---

# Test for preview link change

Saved queries are a way to save commonly used queries in MetricFlow. You can group metrics, dimensions, and filters that are logically related into a saved query. Saved queries are nodes and visible in the dbt <Term id="dag" />.

Saved queries serve as the foundational building block, allowing you to [configure exports](#configure-exports) in your saved query configuration. Exports takes this functionality a step further by enabling you to [schedule and write saved queries](/docs/use-dbt-semantic-layer/exports) directly within your data platform using [dbt Cloud's job scheduler](/docs/deploy/job-scheduler).
Expand Down

0 comments on commit b050146

Please sign in to comment.