PR Preview #8056
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: PR Preview | |
| on: | |
| workflow_run: | |
| workflows: [PR Build] | |
| types: | |
| - completed | |
| permissions: | |
| actions: read | |
| statuses: write | |
| jobs: | |
| pr-preview: | |
| timeout-minutes: 10 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: haya14busa/action-workflow_run-status@v1 | |
| - name: Get PR Event | |
| id: get-pr-event | |
| uses: potiuk/get-workflow-origin@v1_5 | |
| with: | |
| token: ${{secrets.GITHUB_TOKEN}} | |
| sourceRunId: ${{github.event.workflow_run.id}} | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| with: | |
| ref: ${{steps.get-pr-event.outputs.sourceHeadBranch}} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version-file: '.nvmrc' | |
| - name: Download Docs Artifact | |
| id: download-docs | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: docs | |
| path: dist | |
| run-id: ${{github.event.workflow_run.id}} | |
| github-token: ${{ github.token }} | |
| - name: Download Coverage Artifact | |
| id: download-coverage | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: coverage | |
| path: dist/docs | |
| run-id: ${{github.event.workflow_run.id}} | |
| github-token: ${{ github.token }} | |
| - name: Check For Docs | |
| id: check-for-docs | |
| run: | | |
| if [ -d dist/docs ] && [ "$(ls -A dist/docs)" ]; then | |
| echo "found=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "found=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Deploy Docs Preview | |
| if: ${{ steps.check-for-docs.outputs.found == 'true' }} | |
| timeout-minutes: 5 | |
| env: | |
| NETLIFY_AUTH_TOKEN: ${{secrets.NETLIFY_AUTH_TOKEN}} | |
| run: npx netlify-cli deploy --no-build --site ${{secrets.NETLIFY_SITE_NAME}} --alias ${{steps.get-pr-event.outputs.pullRequestNumber}} |