Skip to content

chore(docs): add cantina full report no draft stamp #126

chore(docs): add cantina full report no draft stamp

chore(docs): add cantina full report no draft stamp #126

Workflow file for this run

name: ci pr docs
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_DOCS_PROJECT_ID }}
on:
pull_request:
paths:
- 'docs/**'
jobs:
deploy:
runs-on: ubuntu-latest
outputs:
url: ${{ steps.deploy.outputs.deployment_url }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install PNPM
uses: pnpm/action-setup@v4
with:
version: 8
- name: Install Vercel CLI
run: pnpm install --global vercel@latest
- name: Check if External PR
id: check_external
run: |
if [ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]; then
echo "external=true" >> $GITHUB_ENV
else
echo "external=false" >> $GITHUB_ENV
fi
- name: Deploy with Vercel
id: deploy
if: env.external == 'false'
run: |
vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
vercel build --token=${{ secrets.VERCEL_TOKEN }}
echo "deployment_url=$(vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }})" >> $GITHUB_OUTPUT
comment:
needs: deploy
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
pull-requests: write
steps:
- name: Comment on PR
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const isExternal = process.env.external === 'true';
const deploymentUrl = isExternal ? null : '${{ needs.deploy.outputs.url }}';
const message = isExternal
? "Preview deployment skipped for external pull requests."
: `Docs preview complete 🚀 see it here: ${deploymentUrl}`;
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body: message,
});