Pin Browser SDK v3 npm install to @signalwire/js@3.30.0 #1068
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: preview-docs | |
| on: pull_request | |
| jobs: | |
| preview: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - name: Install dependencies | |
| run: yarn install | |
| - name: Build and generate preview | |
| id: generate-docs | |
| env: | |
| FERN_TOKEN: ${{ secrets.FERN_TOKEN }} | |
| run: | | |
| yarn build 2>&1 | tee /tmp/build.log | |
| if [ ${PIPESTATUS[0]} -ne 0 ]; then | |
| exit 1 | |
| fi | |
| URL=$(grep -oP 'Published docs to \Khttps://[^\s]+' /tmp/build.log | head -1) | |
| if [ -z "$URL" ]; then | |
| echo "::error::Could not extract preview URL from build output" | |
| exit 1 | |
| fi | |
| echo "preview_url=$URL" >> $GITHUB_OUTPUT | |
| - name: Post preview comment | |
| uses: actions/github-script@v7 | |
| env: | |
| PREVIEW_URL: ${{ steps.generate-docs.outputs.preview_url }} | |
| with: | |
| script: | | |
| const previewUrl = process.env.PREVIEW_URL; | |
| const MARKER = '<!-- preview-docs-bot -->'; | |
| let body = MARKER + '\n'; | |
| body += `## 🌿 Preview\n\n`; | |
| body += `${previewUrl}`; | |
| body += `\n\n---\n[View workflow run](https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId})`; | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| }); | |
| const existing = comments.find(c => c.body.includes(MARKER)); | |
| if (existing) { | |
| await github.rest.issues.updateComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: existing.id, | |
| body | |
| }); | |
| } else { | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body | |
| }); | |
| } |