Skip to content

Commit

Permalink
adds a commenting script with the preview URL
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesfrye committed Sep 27, 2024
1 parent f55a1d6 commit 2439522
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,24 @@ jobs:
fetch-depth: 1
path: modal/examples

- name: Build the docs
- name: Build and deploy preview
id: deploy_preview
working-directory: modal
run: |
inv frontend-preview --skip-update --deployment-id ${GITHUB_SHA::7}
export DEPLOYMENT_ID=${GITHUB_SHA::7}
inv frontend-preview --skip-update --deployment-id $DEPLOYMENT_ID | tee output.txt
DEPLOYMENT_URL=$(cat output.txt | grep "$DEPLOYMENT_ID" | grep "modal.run" | tail -n 1)
echo "DEPLOYMENT_URL=$DEPLOYMENT_URL" >> $GITHUB_OUTPUT
- name: Post a comment with the preview URL
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GH_PAT }}
script: |
const deploymentUrl = `${{ steps.deploy_preview.outputs.DEPLOYMENT_URL }}`;
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `🚀 The docs preview is ready! Check it out here: ${deploymentUrl}`
});

0 comments on commit 2439522

Please sign in to comment.