Skip to content

Commit

Permalink
fix: docs preview on master (#10254)
Browse files Browse the repository at this point in the history
  • Loading branch information
ludamad authored Nov 27, 2024
1 parent b5783d3 commit 37684cc
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions docs/deploy_preview.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,22 @@ set -eu
PR_NUMBER=$1
AZTEC_BOT_COMMENTER_GITHUB_TOKEN="$2"

API_URL="https://api.github.com/repos/AztecProtocol/aztec-packages/pulls/${PR_NUMBER}/files"

echo "API URL: $API_URL"

DOCS_CHANGED=$(curl -L \
-H "Authorization: Bearer $AZTEC_BOT_COMMENTER_GITHUB_TOKEN" \
"${API_URL}" | \
jq '[.[] | select(.filename | startswith("docs/"))] | length > 0')

echo "Docs changed: $DOCS_CHANGED"

if [ "$DOCS_CHANGED" = "false" ]; then
echo "No docs changed, not deploying"
exit 0
if [ -n "$PR_NUMBER" ] ; then
API_URL="https://api.github.com/repos/AztecProtocol/aztec-packages/pulls/${PR_NUMBER}/files"

echo "API URL: $API_URL"

DOCS_CHANGED=$(curl -L \
-H "Authorization: Bearer $AZTEC_BOT_COMMENTER_GITHUB_TOKEN" \
"${API_URL}" | \
jq '[.[] | select(.filename | startswith("docs/"))] | length > 0')

echo "Docs changed: $DOCS_CHANGED"

if [ "$DOCS_CHANGED" = "false" ]; then
echo "No docs changed, not deploying"
exit 0
fi
fi

# Regular deploy if the argument is not "master" and docs changed
Expand All @@ -27,5 +29,5 @@ echo "Unique deploy URL: $DOCS_PREVIEW_URL"

cd ../yarn-project/scripts
if [ -n "$PR_NUMBER" ] ; then
AZTEC_BOT_COMMENTER_GITHUB_TOKEN=$AZTEC_BOT_COMMENTER_GITHUB_TOKEN PR_NUMBER=$PR_NUMBER DOCS_PREVIEW_URL=$DOCS_PREVIEW_URL yarn docs-preview-comment
AZTEC_BOT_COMMENTER_GITHUB_TOKEN=$AZTEC_BOT_COMMENTER_GITHUB_TOKEN PR_NUMBER=$PR_NUMBER DOCS_PREVIEW_URL=$DOCS_PREVIEW_URL yarn docs-preview-comment
fi

0 comments on commit 37684cc

Please sign in to comment.